eZ\Publish\Core\Persistence\Legacy\Content\Mapper::extractContentInfoFromRows PHP Method

extractContentInfoFromRows() public method

Extracts ContentInfo objects from $rows.
public extractContentInfoFromRows ( array $rows, string $prefix = '', string $treePrefix = 'ezcontentobject_tree_' ) : eZ\Publish\SPI\Persistence\Content\ContentInfo[]
$rows array
$prefix string Prefix for row keys, which are initially mapped by ezcontentobject fields
$treePrefix string Prefix for tree row key, which are initially mapped by ezcontentobject_tree_ fields
return eZ\Publish\SPI\Persistence\Content\ContentInfo[]
    public function extractContentInfoFromRows(array $rows, $prefix = '', $treePrefix = 'ezcontentobject_tree_')
    {
        $contentInfoObjects = array();
        foreach ($rows as $row) {
            $contentInfoObjects[] = $this->extractContentInfoFromRow($row, $prefix, $treePrefix);
        }
        return $contentInfoObjects;
    }

Usage Example

コード例 #1
0
ファイル: Handler.php プロジェクト: Pixy/ezpublish-kernel
 /**
  * Finds content objects for the given query.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if Query criterion is not applicable to its target
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Query $query
  * @param array $languageFilter - a map of language related filters specifying languages query will be performed on.
  *        Also used to define which field languages are loaded for the returned content.
  *        Currently supports: <code>array("languages" => array(<language1>,..), "useAlwaysAvailable" => bool)</code>
  *                            useAlwaysAvailable defaults to true to avoid exceptions on missing translations
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult
  */
 public function findContent(Query $query, array $languageFilter = array())
 {
     if (!isset($languageFilter['languages'])) {
         $languageFilter['languages'] = array();
     }
     if (!isset($languageFilter['useAlwaysAvailable'])) {
         $languageFilter['useAlwaysAvailable'] = true;
     }
     $start = microtime(true);
     $query->filter = $query->filter ?: new Criterion\MatchAll();
     $query->query = $query->query ?: new Criterion\MatchAll();
     if (count($query->facetBuilders)) {
         throw new NotImplementedException('Facets are not supported by the legacy search engine.');
     }
     // The legacy search does not know about scores, so that we just
     // combine the query with the filter
     $filter = new Criterion\LogicalAnd(array($query->query, $query->filter));
     $data = $this->gateway->find($filter, $query->offset, $query->limit, $query->sortClauses, $languageFilter, $query->performCount);
     $result = new SearchResult();
     $result->time = microtime(true) - $start;
     $result->totalCount = $data['count'];
     $contentInfoList = $this->contentMapper->extractContentInfoFromRows($data['rows'], '', 'main_tree_');
     foreach ($contentInfoList as $index => $contentInfo) {
         $searchHit = new SearchHit();
         $searchHit->valueObject = $contentInfo;
         $searchHit->matchedTranslation = $this->extractMatchedLanguage($data['rows'][$index]['language_mask'], $data['rows'][$index]['initial_language_id'], $languageFilter);
         $result->searchHits[] = $searchHit;
     }
     return $result;
 }
All Usage Examples Of eZ\Publish\Core\Persistence\Legacy\Content\Mapper::extractContentInfoFromRows