@param string $entityClass
@param string $rel

@return Collection
507154
protected function loadResources(string $entityClass, string $rel): Collection
    {
        $uri = $this->resource->getLinks()->getHref($rel);
        $resources = $this->restClient->getResources($entityClass, $rel, $uri);

        $entities = $resources->map(function (HalResource $resource) {
            return $resource->getEntity();
        });

        return new Collection($entities);
    }
825108
public function fromType(string $entityClass, string $tableName = null)
    {
        $this->from($this->orm->getEntityMapper($entityClass, $tableName));
    }
609686
public T withManagedEntityClasses(List<Class<?>> entityClasses) {
        configMap.put(MANAGED_ENTITIES, entityClasses);
        return getThis();
    }
36137
public static function createEntities($entityClass, $dataArray)
    {
        return array_map(function ($data) use ($entityClass) {
            return static::createEntity($entityClass, $data);
        }, $dataArray);
    }
490198
public static function createFor($entityClass, $collectionPropertyName, DCPackage $dc) {
    $entityMeta = $dc->getEntityMeta($entityClass);
    $property = $entityMeta->getPropertyMeta($collectionPropertyName);
    $collectionClass = $property->getRelationEntityClass();
    
    $synchronizer = new static(
      $entityMeta,
      $property->getName(),
      new UniqueEntityHydrator($dc->getEntityManager()->getRepository($collectionClass->getFQN())),
      new EntityFactory($dc->getEntityMeta($collectionClass->getFQN()))
    );
    
    return $synchronizer;
  }
102131
protected function getEntityClass($entityClass)
    {
        if (!isset($this->entityClasses[$entityClass])) {

            $found = class_exists($entityClass);

            if ($found) {
                $reflection = new \ReflectionClass($entityClass);
                $fqcn = '\\' . $reflection->getName();
            } elseif (strpos('\\', $entityClass) !== 0) {
                foreach ($this->entityNamespaces as $namespace) {
                    $fqcn = '\\' . trim($namespace, '\\') . '\\' . $entityClass;
                    if (class_exists($fqcn)) {
                        $found = true;
                        break;
                    }
                }
            }

            if (!$found) {
                throw new \DomainException('Entity class not found: ' . $entityClass);
            }

            $this->entityClasses[$entityClass] = $fqcn;
        }

        return $this->entityClasses[$entityClass];
    }
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);
    }
676275
public function findPaginated(
        $entityClass,
        array $criteria,
        $sorting = [],
        $offset = Request\Params::DEFAULT_PAGE_OFFSET,
        $limit = Request\Params::DEFAULT_PAGE_SIZE,
        $translatable = false
    )
    {
        $qb = $this->getQueryBuilder($entityClass, $criteria, $sorting, $translatable);
        
        $qb->setFirstResult($offset)
            ->setMaxResults($limit);

        $paginator = new Paginator($qb->getQuery());
        $collection = new PaginatedCollection($paginator);

        return $collection;
    }
928597
public static function getCodeGenerators($entityClass = null)
    {
        if ($entityClass) {
            if (!isset(self::$generators[$entityClass])) {
                throw new \Exception("There is no registered entity code generator for class $entityClass");
            }

            return self::$generators[$entityClass];
        } else {
            return self::$generators;
        }
    }
224960
protected function createEntities(array $rows, $entityClass = null, $table = null)
    {
        if ($table === null) {
            $table = $this->getTable();
        }
        $entities = [];
        $collection = Result::createInstance($rows, $table, $this->connection, $this->mapper);
        $primaryKey = $this->mapper->getPrimaryKey($this->getTable());
        if ($entityClass !== null) {
            foreach ($rows as $dibiRow) {
                $entity = $this->entityFactory->createEntity(
                    $entityClass,
                    $collection->getRow($dibiRow->$primaryKey)
                );
                $entity->makeAlive($this->entityFactory);
                $entities[$dibiRow->$primaryKey] = $entity;
            }
        } else {
            foreach ($rows as $dibiRow) {
                $row = $collection->getRow($dibiRow->$primaryKey);
                $entityClass = $this->mapper->getEntityClass($this->getTable(), $row);
                $entity = $this->entityFactory->createEntity($entityClass, $row);
                $entity->makeAlive($this->entityFactory);
                $entities[$dibiRow->$primaryKey] = $entity;
            }
        }
        return $this->entityFactory->createCollection($entities);
    }
1241989
public function loadWith(array $rels)
    {
        $models = $this->load();

        $this->getRepo()->loadAllRelsFor($models, $rels, $this->flags);

        return $models;
    }
13290
public function getMetadata($entityOrClass)
    {
        $this->init();

        $entityClass = is_object($entityOrClass) ? ClassUtils::getClass($entityOrClass) : $entityOrClass;

        if (isset($this->entityOverride[$entityClass])) {
            $entityClass = $this->entityOverride[$entityClass];
        }
        if (!isset($this->metadata[$entityClass])) {
            $childClass = $entityClass;

            while ($parentClass = get_parent_class($childClass)) {
                if (isset($this->metadata[$parentClass])) {
                    $this->metadata[$entityClass] = $this->metadata[$parentClass];

                    return $this->metadata[$parentClass];
                }

                $childClass = $parentClass;
            }

            throw new MetadataException(sprintf('Unable to get metadata for class "%s".', $entityClass));
        }

        return $this->metadata[$entityClass];
    }
816663
public function getRepository($entityClass)
    {
        $container = $this->getContainer();

        $em = $container->get('doctrine')->getManager();

        /* @var EntityRepository $repository */
        return $em->getRepository($entityClass);
    }
397216
private function getEntityId($entity, $entityClass)
    {
        $ids = $this->em->getClassMetadata($entityClass)->getIdentifierValues($entity);

        return reset($ids);
    }
19931
@Override
  public <T> boolean collectionExists(Class<T> entityClass) {
    return collectionExists(Util.determineCollectionName(entityClass));
  }
461539
public function documentToEntity($document, string $entityClassName)
    {
        if (!$this->annotationParser->isEntityClass($entityClassName)) {
            return $document;
        }

        try {
            $reflectClass = new \ReflectionClass($entityClassName);
        } catch (\Exception $exception) {
            return $document;
        }

        $entity = new $entityClassName();

        foreach ($reflectClass->getProperties() as $documentProperty) {
            if ($documentProperty->isStatic()) {
                continue;
            }

            $annotation = $this->annotationParser->getPropertyAnnotation($documentProperty);
            if (null === $annotation) {
                continue;
            }

            $propertyName = $annotation->name ?? $documentProperty->getName();
            if ($annotation->id) {
                $propertyName = '_id';
            }
            $propertyValue = $document->{$propertyName} ?? null;
            $fieldValue = $this->propertyToField($propertyValue, $annotation);

            $documentProperty->setAccessible(true);
            $documentProperty->setValue($entity, $fieldValue);
        }

        return $entity;
    }
814947
public function getByEntityBuilder($entityClass, $entityId, array $properties = [])
    {
        $qb = $this->createDefaultBuilder()
            ->andWhere('o.objectClass = :entity_class')
            ->setParameter('entity_class', $entityClass)
            ->andWhere('o.objectId = :entity_id')
            ->setParameter('entity_id', $entityId);

        return !empty($properties) ? $qb->andWhere($qb->expr()->in('o.property', $properties)) : $qb;
    }