Gets the EntityPersister for an Entity.

@param string $entityName The name of the Entity.

@return \Doctrine\ORM\Persisters\Entity\EntityPersister
346212
public function getEntityPersister($entityName)
    {
        if (isset($this->persisters[$entityName])) {
            return $this->persisters[$entityName];
        }

        $class = $this->em->getClassMetadata($entityName);

        switch (true) {
            case ($class->isInheritanceTypeNone()):
                $persister = new BasicEntityPersister($this->em, $class);
                break;

            case ($class->isInheritanceTypeSingleTable()):
                $persister = new SingleTablePersister($this->em, $class);
                break;

            case ($class->isInheritanceTypeJoined()):
                $persister = new JoinedSubclassPersister($this->em, $class);
                break;

            default:
                throw new \RuntimeException('No persister found for entity.');
        }

        if ($this->hasCache && $class->cache !== null) {
            $persister = $this->em->getConfiguration()
                ->getSecondLevelCacheConfiguration()
                ->getCacheFactory()
                ->buildCachedEntityPersister($this->em, $persister, $class);
        }

        $this->persisters[$entityName] = $persister;

        return $this->persisters[$entityName];
    }
191242
public function getXmlEntityPersister($entityName)
    {
        if ( ! isset($this->persisters[$entityName])) {
            $class = $this->xem->getClassMetadata($entityName);
            $this->persisters[$entityName] = new Persisters\RootXmlEntityPersister($this->xem, $class);
        }
        return $this->persisters[$entityName];
    }
1162208
public function read($entityName)
    {
        return new ReadQuery(
            $this->connection,
            $this->models->get($entityName),
            $this->factory,
            $this->accessor,
            $this->dispatcher
        );
    }
18914
public function readOne($entityName)
    {
        return new ReadOneQuery(
            $this->connection,
            $this->models->get($entityName),
            $this->factory,
            $this->accessor,
            $this->dispatcher
        );
    }
1109733
private function getEntityManager()
    {
        if(null === $this->entityManager) {
            $this->entityManager = $this->serviceLocator->get('doctrine.entitymanager.orm_default');
        }
    
        return $this->entityManager;
    }
646251
protected function getRepository ($persistentObject = null) : EntityRepository
    {
        if (null === $persistentObject)
        {
            $persistentObject = $this->getFullEntityName();
        }

        return $this->doctrine->getRepository($persistentObject);
    }
50634
public function newManager($classname) {
		$profile = Profiler::getClassProfile($classname);
		if (!$profile->isEntity())
			throw new \InvalidArgumentException(sprintf("Class %s is not declared as an entity", $profile->reflectionClass->getName()));
		return new Manager($this, $profile);
	}
518987
protected function getRepository($persistentObjectName, $persistentManagerName = null)
    {
        return $this->container->get('doctrine')->getRepository($persistentObjectName, $persistentManagerName);
    }
807411
public function getUserTypeEntity($entityId, $fieldName) {
        /** @noinspection PhpDynamicAsStaticMethodCallInspection */
        $item = \CUserTypeEntity::GetList(array(), array(
            'ENTITY_ID' => $entityId,
            'FIELD_NAME' => $fieldName
        ))->Fetch();

        return (!empty($item)) ? $this->getUserTypeEntityById($item['ID']) : false;
    }
436163
protected function getEntityManager()
    {
        if (null === $this->entityManager) {
            $reflectionProperty = new \ReflectionProperty(SQLFilter::class, 'em');
            $reflectionProperty->setAccessible(true);
            $this->entityManager = $reflectionProperty->getValue($this);
        }

        return $this->entityManager;
    }
882312
public function getNodeByEntityName($entityName)
    {
        if (false !== ($index = array_search($entityName, $this->nodesEntities))) {
            if ($this->offsetExists($index)) {
                return $this->offsetGet($index);
            }
        }

        return false;
    }
463362
private function getObjectManager($entityClassname)
    {
        $objectManager = $this->getContainer()->get('doctrine')->getManagerForClass($entityClassname);
        if ($objectManager) {
            return $objectManager;
        }

        $objectManager = $this->getContainer()->get('doctrine_mongodb')->getManagerForClass($entityClassname);
        if ($objectManager) {
            return $objectManager;
        }

        throw new \RuntimeException(sprintf('Class "%s" is not a managed entity', $entityClassname));
    }
1004778
public function getRepository(Entity $entity)
    {
        $repo = $this->getRepositories()[get_class($entity)];

        return $this->$repo;
    }
298438
public function getRepositoryForEntity(string $entityName, string $connectionName = null): AbstractRepository
    {
        /** @var AbstractRepository $repository */
        $repository = $this->loadFactorableInstance($entityName);

        if (is_string($connectionName)) {
            $entityManager = $this->getContainer()->get('doctrine')->getManager($connectionName);
            $repository->setEntityManager($entityManager);
        }

        $this->onFactorableLoaded($repository);

        return $repository;
    }
616987
public function getEntityBuilder($className = null, ClassMetadata $classMetadata = null)
    {
        $builder = new Entity\Builder($this->getMapper(), $this->getFieldManager());

        if ($className !== null) {
            $builder->setClass($className);
        }

        if ($classMetadata !== null) {
            $builder->setClassMetadata($classMetadata);
        }

        return $builder;
    }
521729
protected function getObjectManager(string $entityNamespace): ? ObjectManager
    {
        return $this
            ->get('base.object_manager_provider')
            ->getObjectManagerByEntityNamespace(
                $this->locateEntity($entityNamespace)
            );
    }
1140175
public function getNodeForIdAndEntityname($id, $entityName)
    {
        /* @var NodeVersion $nodeVersion */
        $nodeVersion = $this->getEntityManager()->getRepository(
            'KunstmaanNodeBundle:NodeVersion'
        )->findOneBy(
            array('refId' => $id, 'refEntityName' => $entityName)
        );
        if ($nodeVersion) {
            return $nodeVersion->getNodeTranslation()->getNode();
        }

        return null;
    }