src/Pok/PoolDBM/Persisters/ModelBuilder.php
public function loaderModels(ClassMetadata $class, $manager, array $ids, \Closure $stacker)
    {
        $classOfManagerName = $class->getFieldMapping($manager);

        $pool       = $this->manager->getPool();
        $methodFind = $classOfManagerName->getRepositoryMethod();

        $repository = $pool->getManager($manager)->getRepository($classOfManagerName->getName());

        if ($methodFind && method_exists($repository, $methodFind)) {
            foreach ($repository->$methodFind($ids) as $object) {
                $id = $class->getIdentifierValue($object);

                $stacker($id, $object);
            }
        } else {
            trigger_error(sprintf('findOneBy in ModelPersister::loadAll context is depreciate. Define repository-method for "%s" manager model, see mapping for "%s".', $manager, $class->getName()), E_USER_DEPRECATED);

            $repository = $pool->getManager($manager)->getRepository($classOfManagerName->getName());
            $field      = $class->getIdentifierReference($manager)->field;

            foreach ($ids as $id) {
                $object = $repository->findOneBy(array($field => $id));

                if (!$object) {
                    continue;
                }

                $id = $class->getIdentifierValue($object, $manager);

                $stacker($id, $object);
            }
        }
    }
public function loaderModels(ClassMetadata $class, $manager, array $ids, \Closure $stacker)
    {
        $classOfManagerName = $class->getFieldMapping($manager);

        $pool       = $this->manager->getPool();
        $methodFind = $classOfManagerName->getRepositoryMethod();

        $repository = $pool->getManager($manager)->getRepository($classOfManagerName->getName());

        if ($methodFind && method_exists($repository, $methodFind)) {
            foreach ($repository->$methodFind($ids) as $object) {
                $id = $class->getIdentifierValue($object);

                $stacker($id, $object);
            }
        } else {
            trigger_error(sprintf('findOneBy in ModelPersister::loadAll context is depreciate. Define repository-method for "%s" manager model, see mapping for "%s".', $manager, $class->getName()), E_USER_DEPRECATED);

            $repository = $pool->getManager($manager)->getRepository($classOfManagerName->getName());
            $field      = $class->getIdentifierReference($manager)->field;

            foreach ($ids as $id) {
                $object = $repository->findOneBy(array($field => $id));

                if (!$object) {
                    continue;
                }

                $id = $class->getIdentifierValue($object, $manager);

                $stacker($id, $object);
            }
        }
    }
public function loaderModels ( ClassMetadata $ class , $ manager , array $ ids , \ Closure $ stacker ) { $ classOfManagerName = $ class -> getFieldMapping ( $ manager ) ; $ pool = $ this -> manager -> getPool ( ) ; $ methodFind = $ classOfManagerName -> getRepositoryMethod ( ) ; $ repository = $ pool -> getManager ( $ manager ) -> getRepository ( $ classOfManagerName -> getName ( ) ) ; if ( $ methodFind && method_exists ( $ repository , $ methodFind ) ) { foreach ( $ repository -> $ methodFind ( $ ids ) as $ object ) { $ id = $ class -> getIdentifierValue ( $ object ) ; $ stacker ( $ id , $ object ) ; } } else { trigger_error ( sprintf ( 'findOneBy in ModelPersister::loadAll context is depreciate. Define repository-method for "%s" manager model, see mapping for "%s".' , $ manager , $ class -> getName ( ) ) , E_USER_DEPRECATED ) ; $ repository = $ pool -> getManager ( $ manager ) -> getRepository ( $ classOfManagerName -> getName ( ) ) ; $ field = $ class -> getIdentifierReference ( $ manager ) -> field ; foreach ( $ ids as $ id ) { $ object = $ repository -> findOneBy ( array ( $ field => $ id ) ) ; if ( ! $ object ) { continue ; } $ id = $ class -> getIdentifierValue ( $ object , $ manager ) ; $ stacker ( $ id , $ object ) ; } } }
Performed research on the model via their repository.

@param ClassMetadata $class
@param string        $manager
@param array         $ids
@param callable      $stacker
Performed research on the model via their repository .