public getSnippets ( string $locale, string $type = null, integer $offset = null, integer $max = null, string $search = null, string $sortBy = null, string $sortOrder = null ) : |
||
$locale | string | |
$type | string | Optional snippet type |
$offset | integer | Optional offset |
$max | integer | Optional max |
$search | string | |
$sortBy | string | |
$sortOrder | string | |
Результат |
public function getSnippets($locale, $type = null, $offset = null, $max = null, $search = null, $sortBy = null, $sortOrder = null)
{
$query = $this->getSnippetsQuery($locale, $type, $offset, $max, $search, $sortBy, $sortOrder);
$documents = $this->documentManager->createQuery($query, $locale, ['load_ghost_content' => true])->execute();
return $documents;
}
public function testOrder() { $snippets = $this->snippetRepository->getSnippets('de', 'car'); $this->assertNotNull($snippets); $this->assertCount(3, $snippets); $first = current($snippets); $this->assertEquals('A car', $first->getProperty('title')->getValue()); $second = next($snippets); $this->assertEquals('B car', $second->getProperty('title')->getValue()); $third = next($snippets); $this->assertEquals('C car', $third->getProperty('title')->getValue()); }