@param object $entity

@throws InvalidArgumentException

@return string
188923
public function getAdminType($entity)
    {
        if (null !== $this->type) {
            return $this->type;
        }

        if (method_exists($entity, 'getAdminType')) {
            return $entity->getAdminType();
        }

        throw new InvalidArgumentException(
            'You need to implement the getAdminType method in '.
            get_class($this).' or '.get_class($entity)
        );
    }
1307293
public function getMapperFor($entity)
    {
        return  $this->mappers->containsKey($entity)
            ? $this->mappers->get($entity)
            : $this->createMapper($entity);
    }
1167632
public function remove($entity)
    {
        if ( ! is_object($entity)) {
            throw new \InvalidArgumentException(gettype($entity));
        }
        $this->errorIfClosed();
        $this->unitOfWork->remove($entity);
    }
983650
private function hashEntity($entity)
    {
        $class = ClassUtils::getClass($entity);

        $ids = $this->em->getClassMetadata($class)->getIdentifierValues($entity);

        return $class.spl_object_hash($entity).reset($ids);
    }
1318950
private function getDrupalEntityPath($type, $entity)
    {
        $uri = entity_uri($type, $entity);

        if (!$uri) {
            throw new \InvalidArgumentException(sprintf("%s: entity type is not supported yet"));
        }

        return $uri['path'];
    }
183064
public function getEventNamePrefix($entity)
    {
        if (is_object($entity)) {
            $eventPrefix = strtolower(str_replace(NAMESPACE_SEPARATOR, '.', get_class($entity)).'.');
        } else {
            $eventPrefix = strtolower(str_replace(NAMESPACE_SEPARATOR, '.', $entity).'.');
        }
        if ($entity instanceof \Doctrine\ORM\Proxy\Proxy) {
            $prefix = str_replace(NAMESPACE_SEPARATOR, '.', $this->application->getEntityManager()->getConfiguration()->getProxyNamespace());
            $prefix .= '.'.$entity::MARKER.'.';

            $eventPrefix = str_replace(strtolower($prefix), '', $eventPrefix);
        }

        $eventPrefix = str_replace(array('backbee.', 'classcontent.'), array('', ''), $eventPrefix);

        return $eventPrefix;
    }
899822
private function getContentFromEntity( $entity ) {
		switch ( $entity->getType() ) {
			case Item::ENTITY_TYPE:
				return new ItemContent( $entity );
			case Property::ENTITY_TYPE:
				return new PropertyContent( $entity );
			default:
				throw new RuntimeException( 'I cant get a content for this type of entity' );
		}
	}
535096
protected function getIdentifier($entity)
    {
        $entityId = json_decode($this->entityRegistry->getEntityId($entity), true);

        if (is_array($entityId)) {
            $identifier = [];

            foreach ($entityId as $key => $value) {
                $key              = strtolower(Normalise::toUnderscoreSeparated(Normalise::fromCamelCase($key)));
                $identifier[$key] = $value;
            }

            return $identifier;
        }

        $primary = $this->builder->getMeta(get_class($entity))->primary;

        return [$primary => $entityId];
    }
642349
protected function getEntityTable($entity)
    {
        if (!$entity instanceof EntityInterface) {
            $entity = $this->getEntityClass($entity);
        }
        return $this->tablePrefix . $entity::getTable() . $this->tableSuffix;
    }
133249
public function referencedBy( $entity )
    {

        if( !( $entity instanceof Base || $entity instanceof Container ) ) {
            throw new \InvalidArgumentException("You can only lookup references by Entity or Container");
        }

        $class = $entity instanceof Container
            ? $entity->class
            : $entity;

        $properties = $this->propertiesOfTypeGet( $class );

        // found a entity?
        if( !$properties ) {
            throw new \LogicException(
                sprintf(
                    "Can't find which entity property for repository `%s` references entity of type `%s`",
                    $this->entity,
                    $entityClass
                )
            );
        } elseif( count( $properties ) > 1 ) {
            throw new \LogicException(
                sprintf(
                    "Multiple columns [%s] reference a entity of this type [%s]. This is ambiguous. Can't help you here.",
                    implode( ",", $properties ),
                    \Bond\get_unqualified_class( $entity )
                )
            );
        }

        $property = array_pop( $properties );

        // get references to this entity
        $filterComponent = $this->getFindFilterFactory()
            ->get( $property, null, $entity );

        return $this->findByFilterComponents(
            FindFilterComponentFactory::FIND_ALL,
            array( $property => $filterComponent )
        );

    }
1011483
private function getIdentifierValues($entity)
    {
        try {
            return $this->modelManager->getIdentifierValues($entity);
        } catch (\Exception $e) {
            throw new \InvalidArgumentException(sprintf('Unable to retrieve the identifier values for entity %s', \get_class($entity)), 0, $e);
        }
    }
645479
protected function getValue($entity)
    {
        $value = $this->getFieldValue($entity);

        if ($this->formatter) {
            return $this->formatter->formatValue($value);
        }
        else {
            if ($value instanceof \DateTime) {
                $formatter = new DateTimeCellFormatter($this->getDateTimeFormat());
                return $formatter->formatValue($value);
            }
            else {
                return $value;
            }
        }
    }
965895
public function serialize($entity)
    {
        return array($this->getName().'.'.$this->_target_parent_key => $entity->get($this->_target_parent_key));
    }
919973
private function extractIdentity(object $entity): Identity
    {
        $identity = ($this->metadata)(get_class($entity))->identity()->property();

        return ReflectionObject::of($entity)
            ->extract($identity)
            ->get($identity);
    }
104292
public function getMetaData($entity)
    {
        $propertyAnnotations = [];
        $result = new \stdClass;
        $class = new \ReflectionClass($entity);
        $classAnnotations = $this->_reader->getClassAnnotations($class);
        foreach ($class->getProperties() as $key => $value) {
            $annotation = $this->_reader->getPropertyAnnotations(new \ReflectionProperty($entity, $value->name));
            if (count($annotation)) {
                $propertyAnnotations[$value->name] = array_pop($annotation);
            }
        }

        foreach ($classAnnotations as $annotation) {
            if ($annotation instanceof \MercadoPago\Annotation\RestMethod) {
                $result->methods[$annotation->method] = get_object_vars($annotation);
            }
            if ($annotation instanceof \MercadoPago\Annotation\RequestParam) {
                $result->params[] = $annotation->param;
            }
            if ($annotation instanceof \MercadoPago\Annotation\DenyDynamicAttribute) {
                $result->denyDynamicAttribute = true;
            }
        }

        foreach ($propertyAnnotations as $key => $annotation) {
            if ($annotation instanceof \MercadoPago\Annotation\Attribute) {
                $result->attributes[$key] = get_object_vars($annotation);
            }
        }

        return $result;
    }
237919
protected function getClassKey($entity)
    {
        $parts = explode('.', $entity);
        $class = array_shift($parts);

        // Ensure the `.ss` suffix gets added to the top level class rather than the key
        if (count($parts) > 1 && reset($parts) === 'ss') {
            $class .= '.ss';
            array_shift($parts);
        }
        $key = implode('.', $parts);
        return array($class, $key);
    }
813939
public function getManagerForEntity($entity): EntityManagerInterface
    {
        $class = ClassUtils::getClass($entity);
        $entityManager = $this->doctrine->getManagerForClass($class);
        if (!$entityManager instanceof EntityManagerInterface) {
            throw new \InvalidArgumentException("No manager found for class {$class}");
        }

        return $entityManager;
    }