src/Pckg/Database/Repository/PDO/Command/GetRecords.php
public function executeAll()
    {
        $repository = $this->repository;

        $entity = $this->entity;

        $prepare = $repository->prepareQuery($entity->getQuery(), $entity->getRecordClass());

        $measure = str_replace("\n", " ", $prepare->queryString);
        $hash = sha1($measure . microtime());

        startMeasure('Executing ' . $measure);
        $execute = $repository->executePrepared($prepare);
        stopMeasure('Executing ' . $measure);

        if (!$execute) {
            return new Collection();
        }

        $results = $repository->fetchAllPrepared($prepare);

        if (!$results) {
            return new Collection();
        }

        $collection = new Collection($results);
        if ($entity->getQuery()->isCounted()) {
            startMeasure('Counting ' . $hash);
            $prepareCount = $repository->prepareSQL('SELECT FOUND_ROWS()');
            $repository->executePrepared($prepareCount);
            $collection->setTotal($prepareCount->fetch(PDO::FETCH_COLUMN));
            $entity->count(false);
            stopMeasure('Counting ' . $hash);
        }

        startMeasure('Setting original ' . $hash);
        $collection->setEntity($entity)->setSaved()->setOriginalFromData();
        stopMeasure('Setting original ' . $hash);

        startMeasure('Filling relations ' . $hash);
        $filled = $entity->fillCollectionWithRelations($collection);
        stopMeasure('Filling relations ' . $hash);

        return $filled;
    }
public function executeAll()
    {
        $repository = $this->repository;

        $entity = $this->entity;

        $prepare = $repository->prepareQuery($entity->getQuery(), $entity->getRecordClass());

        $measure = str_replace("\n", " ", $prepare->queryString);
        $hash = sha1($measure . microtime());

        startMeasure('Executing ' . $measure);
        $execute = $repository->executePrepared($prepare);
        stopMeasure('Executing ' . $measure);

        if (!$execute) {
            return new Collection();
        }

        $results = $repository->fetchAllPrepared($prepare);

        if (!$results) {
            return new Collection();
        }

        $collection = new Collection($results);
        if ($entity->getQuery()->isCounted()) {
            startMeasure('Counting ' . $hash);
            $prepareCount = $repository->prepareSQL('SELECT FOUND_ROWS()');
            $repository->executePrepared($prepareCount);
            $collection->setTotal($prepareCount->fetch(PDO::FETCH_COLUMN));
            $entity->count(false);
            stopMeasure('Counting ' . $hash);
        }

        startMeasure('Setting original ' . $hash);
        $collection->setEntity($entity)->setSaved()->setOriginalFromData();
        stopMeasure('Setting original ' . $hash);

        startMeasure('Filling relations ' . $hash);
        $filled = $entity->fillCollectionWithRelations($collection);
        stopMeasure('Filling relations ' . $hash);

        return $filled;
    }
public function executeAll ( ) { $ repository = $ this -> repository ; $ entity = $ this -> entity ; $ prepare = $ repository -> prepareQuery ( $ entity -> getQuery ( ) , $ entity -> getRecordClass ( ) ) ; $ measure = str_replace ( "\n" , " " , $ prepare -> queryString ) ; $ hash = sha1 ( $ measure . microtime ( ) ) ; startMeasure ( 'Executing ' . $ measure ) ; $ execute = $ repository -> executePrepared ( $ prepare ) ; stopMeasure ( 'Executing ' . $ measure ) ; if ( ! $ execute ) { return new Collection ( ) ; } $ results = $ repository -> fetchAllPrepared ( $ prepare ) ; if ( ! $ results ) { return new Collection ( ) ; } $ collection = new Collection ( $ results ) ; if ( $ entity -> getQuery ( ) -> isCounted ( ) ) { startMeasure ( 'Counting ' . $ hash ) ; $ prepareCount = $ repository -> prepareSQL ( 'SELECT FOUND_ROWS()' ) ; $ repository -> executePrepared ( $ prepareCount ) ; $ collection -> setTotal ( $ prepareCount -> fetch ( PDO :: FETCH_COLUMN ) ) ; $ entity -> count ( false ) ; stopMeasure ( 'Counting ' . $ hash ) ; } startMeasure ( 'Setting original ' . $ hash ) ; $ collection -> setEntity ( $ entity ) -> setSaved ( ) -> setOriginalFromData ( ) ; stopMeasure ( 'Setting original ' . $ hash ) ; startMeasure ( 'Filling relations ' . $ hash ) ; $ filled = $ entity -> fillCollectionWithRelations ( $ collection ) ; stopMeasure ( 'Filling relations ' . $ hash ) ; return $ filled ; }
Prepare query from entity, fetch records and fill them with relations.

@return CollectionInterface
Prepare query from entity fetch records and fill them with relations .