Creates an entity descriptor for provided class name

The create descriptor is stored in the map

@param string $entityClass

@return EntityDescriptor
966389
private function createDescriptor($entityClass)
    {
        $descriptor = new EntityDescriptor($entityClass);
        $this->descriptors->set($entityClass, $descriptor);
        return $descriptor;
    }
789070
private function getMappings($entityClass)
    {
        if ($this->metadataManager->hasMetadata($entityClass)) {
            return $this->metadataManager->getMetadata($entityClass)->getMappings();
        }
        try {
            return $this->em->getClassMetadata($entityClass)->fieldMappings;
        } catch (MappingException $ex) {
            throw new WidgetException(sprintf('Unable to get Doctrine metadata for class "%s".', $entityClass));
        }
    }
1333463
protected function getTypeStringForEntity($class, EntityMap $entityMap)
    {
        $class = $entityMap->getClass();

        $type = array_keys(
            $entityMap->getDiscriminatorColumnMap(),
            $class
        );

        if (count($type) == 0) {
            return $class;
        }

        return $type[0];
    }
810551
public function generateEntityRepositoryClass(string $entityClass, string $repositoryClass)
    {
        $variables = [
            '<namespace>' => $this->generateEntityRepositoryNamespace($repositoryClass),
            '<entityClassName>' => $entityClass,
            '<entity>' => $this->generateEntityName($entityClass),
            '<repository>' => $this->generateClassName($repositoryClass),
        ];

        return str_replace(array_keys($variables), array_values($variables), self::$_template);
    }
1365805
protected function buildMapper($entity, $entityMap)
    {
        // If an EntityMap hasn't been manually registered by the user
        // register it at runtime.
        if (!$this->isRegisteredEntity($entity)) {
            $this->register($entity, $entityMap);
        }

        $entityMap = $this->entityClasses[$entity];

        $factory = new MapperFactory($this->drivers, $this->eventDispatcher, $this);

        $mapper = $factory->make($entity, $entityMap);

        $this->mappers[$entity] = $mapper;

        // At this point we can safely call the boot() method on the entityMap as
        // the mapper is now instantiated & registered within the manager.

        if (!$entityMap->isBooted()) {
            $entityMap->boot();
        }

        // If a cache is defined, use it to store the entityMap
        if ($this->cache !== null && !$this->cache->has($entityMap->getClass()) && !$this->isAnonymous($entityMap)) {
            $this->cache->set($entityMap->getClass(), serialize($entityMap), 1440);
        }

        return $mapper;
    }
1117085
private function getEntityName($entityClass)
    {
        if ($this->metadataManager->hasMetadata($entityClass)) {
            return $this->metadataManager->getMetadata($entityClass)->getEntityName();
        }
        if ($this->translatableManager->isTranslation($entityClass)) {
            /** @var \Knp\DoctrineBehaviors\Model\Translatable\Translation $entityClass */
            $translatableClass = $entityClass::getTranslatableEntityClass();

            if ($this->metadataManager->hasMetadata($translatableClass)) {
                return $this->metadataManager->getMetadata($translatableClass)->getEntityName().'_translation';
            }
        }

        return $this->objectNamer->name($entityClass);
    }
398504
public function getRepository($entityClass)
    {
        if (is_object($entityClass)) {
            $entityClass = get_class($entityClass);
        }

        if (!isset($this->repositories[$entityClass])) {
            throw new \Exception("no repository defined for: $entityClass");
        }

        if (!is_object($this->repositories[$entityClass])) {
            $this->repositories[$entityClass] = $this->di->get($this->repositories[$entityClass]);
        }

        return $this->repositories[$entityClass];
    }
825108
public function fromType(string $entityClass, string $tableName = null)
    {
        $this->from($this->orm->getEntityMapper($entityClass, $tableName));
    }
365566
private function getDoctrineMetadata($entityClass)
    {
        if (!isset($this->doctrineMetadata[$entityClass])) {
            try {
                $this->doctrineMetadata[$entityClass] = $this->em->getClassMetadata($entityClass);
            } catch (MappingException $ex) {
                throw new FiltererException(sprintf('Unable to get Doctrine metadata for class "%s".', $entityClass));
            }
        }

        return $this->doctrineMetadata[$entityClass];
    }
555060
public function getOrCreate($id, $class)
    {
        /** @var LockableEntity $lockable */
        $lockable = $this->findOneBy(['entityId' => $id, 'entityClass' => $class]);

        if ($lockable === null) {
            $lockable = new LockableEntity();
            $lockable->setEntityClass($class);
            $lockable->setEntityId($id);
        }

        return $lockable;
    }
1207977
private function createMapper($entity)
    {
        $mapper = new EntityMapper();
        $mapper->setAdapter(
            $this->adapters->get(
                $this->getAdapterAlias($entity)
            )
        )
            ->setEntityClassName($entity);
        $this->mappers->set($entity, $mapper);
        return $mapper;
    }
548712
private function getNewObjectFlagMeta($entityClass)
    {
        $meta = $this->extendedMetadataFactory->getExtendedMetadata($entityClass);

        return isset($meta['newObjectFlag']) ? $meta['newObjectFlag'] : [];
    }
250826
protected function getEntity($entityClass = UploadableEntity::class, $driver = 'orm')
    {
        $id = $this->getId();

        $entity = $this->em->find($entityClass, $id);

        if (null === $entity) {
            throw new ObjectNotFoundException($id, $driver);
        }

        return $entity;
    }
646839
public function createBatchDeleteForm($entityClass, array $entities = null)
    {
        if (null !== $entities && empty($entities)) {
            throw new FormException(
                sprintf('Unable to create batch delete form for entity class "%s": entity array is empty.', $entityClass)
            );
        }

        $options = [
            'entity_class' => $entityClass,
        ];

        if (!empty($entities)) {
            $options = array_merge($options, [
                'action'   => $this->adminRouter->generate(reset($entities), $entityClass, AdminRouter::TYPE_BATCH_DELETE),
                'entities' => $entities,
            ]);
        }

        return $this->genericFormFactory->create(BatchDeleteType::class, null, $options);
    }
512625
public function getRelationshipEntityPersister($class)
    {
        if (!array_key_exists($class, $this->relationshipEntityPersisters)) {
            $classMetadata = $this->entityManager->getRelationshipEntityMetadata($class);
            $this->relationshipEntityPersisters[$class] = new RelationshipEntityPersister($this->entityManager, $class, $classMetadata);
        }

        return $this->relationshipEntityPersisters[$class];
    }
1329908
public function create($class) {
        $reflectionClass = new ReflectionClass($class);
        $reflectionMethod = $reflectionClass->getConstructor();
        if (!$reflectionMethod) {
            return new $class;
        }
        $params = &$this->fetchDepsFromSignature($reflectionMethod);
        return $reflectionClass->newInstanceArgs($params);
    }
841627
public function getDocumentPersister(string $documentClass): DocumentPersister
    {
        if (isset($this->documentPersisters[$documentClass])) {
            return $this->documentPersisters[$documentClass];
        }

        return $this->documentPersisters[$documentClass] = new DocumentPersister($this->manager, $this->manager->getClassMetadata($documentClass));
    }