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);
    }
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);
    }
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 ) ; }
Creates new set of Entity's instances from given array of \Dibi\Row instances

@param \Dibi\Row[] $rows
@param string|null $entityClass
@param string|null $table
@return array
Creates new set of Entity s instances from given array of \ Dibi \ Row instances