Sulu\Component\Content\Mapper\ContentMapper::loadByQuery PHP Method

loadByQuery() public method

public loadByQuery ( PHPCR\Query\QueryInterface $query, $locale, $webspaceKey = null, $excludeGhost = true, $loadGhostContent = false )
$query PHPCR\Query\QueryInterface
    public function loadByQuery(QueryInterface $query, $locale, $webspaceKey = null, $excludeGhost = true, $loadGhostContent = false)
    {
        $options = ['exclude_ghost' => $excludeGhost, 'load_ghost_content' => $loadGhostContent];
        $documents = $this->documentManager->createQuery($query, $locale, $options)->execute();
        return $this->documentsToStructureCollection($documents, $options);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Return snippets.
  *
  * If $type is given then only return the snippets of that type.
  *
  * @param string $languageCode
  * @param string $type         Optional snippet type
  * @param int    $offset       Optional offset
  * @param int    $max          Optional max
  * @param string $search
  * @param string $sortBy
  * @param string $sortOrder
  *
  * @throws \InvalidArgumentException
  *
  * @return Snippet[]
  */
 public function getSnippets($languageCode, $type = null, $offset = null, $max = null, $search = null, $sortBy = null, $sortOrder = null)
 {
     $query = $this->getSnippetsQuery($languageCode, $type, $offset, $max, $search, $sortBy, $sortOrder);
     return $this->contentMapper->loadByQuery($query, $languageCode, null, false, true);
 }