Ouzo\Db\ModelResultSetConverter::convert PHP Method

convert() public method

public convert ( $results )
    public function convert($results)
    {
        $aliasToOffset = $this->_createAliasToOffsetMap();
        $joinsToStore = FluentArray::from($this->joinedModels)->filter(Functions::extract()->storeField())->uniqueBy(Functions::extract()->destinationField())->toArray();
        $models = array();
        foreach ($results as $row) {
            $models[] = $this->convertRowToModel($row, $aliasToOffset, $joinsToStore);
        }
        return $this->_fetchRelations($models, $joinsToStore);
    }

Usage Example

Beispiel #1
0
 function _processResults($results)
 {
     $resultSetConverter = new ModelResultSetConverter($this->_model, $this->getModelAliasOrTable(), $this->_joinedModels, $this->_relationsToFetch);
     return $resultSetConverter->convert($results);
 }