@param string $entityName

@return MappingException
325734
public static function identifierRequired($entityName)
    {
        if (false !== ($parent = get_parent_class($entityName))) {
            return new self(sprintf(
                'No identifier/primary key specified for Entity "%s" sub class of "%s". Every Entity must have an identifier/primary key.',
                $entityName, $parent
            ));
        }

        return new self(sprintf(
            'No identifier/primary key specified for Entity "%s". Every Entity must have an identifier/primary key.',
            $entityName
        ));

    }
166989
public function getRepository($entityName, $db = null)
    {
        return \erdiko\doctrine\EntityManager::getEntityManager()->getRepository($entityName);
    }
1162208
public function read($entityName)
    {
        return new ReadQuery(
            $this->connection,
            $this->models->get($entityName),
            $this->factory,
            $this->accessor,
            $this->dispatcher
        );
    }
1207740
public function buildEntityIdMetadata(\SimpleXMLElement $node, $className, \ReflectionClass $reflection)
    {
        if (!isset($node->id) || !isset($node->id['name'])) {
            throw new MappingException(
                sprintf('Class "%s" OGM XML configuration has invalid or missing "id" element', $className)
            );
        }

        return new EntityIdMetadata(
            (string) $node->id['name'],
            $reflection->getProperty((string) $node->id['name']),
            new IdAnnotationMetadata()
        );
    }
1333921
public function getAssociation($fieldName)
    {
        if (!$this->hasAssociation($fieldName)) {
            throw MappingException::associationNotFound($this->name, $fieldName);
        }

        return $this->mappings[$fieldName];
    }
701182
public function getRepository($entityName)
    {
        if (isset($this->repositories[$entityName])) {
            return $this->repositories[$entityName];
        }

        $metadata = $this->getClassMetadata($entityName);
        $repository = new EntityRepository($this, $metadata);
        $this->repositories[$entityName] = $repository;

        return $repository;
    }
88940
public function getNamedNativeQuery($queryName)
    {
        if ( ! isset($this->namedNativeQueries[$queryName])) {
            throw MappingException::queryNotFound($this->name, $queryName);
        }

        return $this->namedNativeQueries[$queryName];
    }
1118845
public function getMetadataFor($className)
    {
        $metadata = parent::getMetadataFor($className);
        if ($metadata) {
            return $metadata;
        }

        throw MappingException::classNotMapped($className);
    }
539525
public function joinKeyColumnName($entityName, $referencedColumnName = null)
    {
        return $this->classToFieldName($entityName) . '_' .
        ($referencedColumnName ?: $this->referenceColumnName());
    }
739133
public function getSqlResultSetMapping($name)
    {
        if ( ! isset($this->sqlResultSetMappings[$name])) {
            throw MappingException::resultMappingNotFound($this->name, $name);
        }

        return $this->sqlResultSetMappings[$name];
    }
341396
public function search($entityName, $query)
    {
        $meta = $this->getSearchableEntityMeta($entityName);

        $qb = $this->em->getRepository($meta->getEntityClass())->createQueryBuilder('o');

        if ($this->translationJoiner->isTranslatable($meta->getEntityClass())) {
            $this->translationJoiner->joinTranslation($qb, true, null, null, true);
        }

        $searchableFields = $this->getSearchableFields($meta);

        try {
            $this->filterer->filter($qb, array_fill_keys($searchableFields, $query), [
                'non_strict_comparison_fields' => $searchableFields,
            ], false);
        } catch (FiltererException $ex) {
            throw new SearchException(
                sprintf('Unable to search for "%s" entities: "%s".', $meta->getEntityClass(), $ex->getMessage())
            );
        }
        try {
            return $qb->getQuery()->getResult();
        } catch (QueryException $ex) {
            throw new SearchException(
                sprintf('Unable to search for "%s" entities: "%s".', $meta->getEntityClass(), $ex->getMessage())
            );
        }
    }
648232
public function addEntityManagerName($entityManagerName)
    {
        $this->getEntityManagerNames()->set(sizeof($this->getEntityManagerNames()->getAllKeys()), $entityManagerName);
    }
825108
public function fromType(string $entityClass, string $tableName = null)
    {
        $this->from($this->orm->getEntityMapper($entityClass, $tableName));
    }
882312
public function getNodeByEntityName($entityName)
    {
        if (false !== ($index = array_search($entityName, $this->nodesEntities))) {
            if ($this->offsetExists($index)) {
                return $this->offsetGet($index);
            }
        }

        return false;
    }
1360768
public function getRepository($entityName)
    {
        if ($entityName instanceof Entity) {
            $entityName = $entityName->getType();
        }

        if (!isset($this->repositories[$entityName])) {
            $plural = $this->getCollectionName($entityName);
            $this->repositories[$entityName] = $this->repositoryFactory->createRepository(
                $entityName,
                $plural
            );
        }

        return $this->repositories[$entityName];
    }
455872
public function getAssociationMapping($fieldName)
    {
        if ( ! isset($this->associationMappings[$fieldName])) {
            throw MappingException::mappingNotFound($this->name, $fieldName);
        }
        return $this->associationMappings[$fieldName];
    }
663826
public function getEntityPersister($entityName)
    {
        if (isset($this->entityPersisters[$entityName])) {
            return $this->entityPersisters[$entityName];
        }

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

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

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

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

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

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

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

        return $this->entityPersisters[$entityName];
    }