Sulu\Bundle\SnippetBundle\Snippet\SnippetRepository::getSnippets PHP 메소드

getSnippets() 공개 메소드

If $type is given then only return the snippets of that type.
public getSnippets ( string $locale, string $type = null, integer $offset = null, integer $max = null, string $search = null, string $sortBy = null, string $sortOrder = null ) : SnippetBridge[]
$locale string
$type string Optional snippet type
$offset integer Optional offset
$max integer Optional max
$search string
$sortBy string
$sortOrder string
리턴 Sulu\Component\Content\Compat\Structure\SnippetBridge[]
    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;
    }

Usage Example

예제 #1
0
 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());
 }
All Usage Examples Of Sulu\Bundle\SnippetBundle\Snippet\SnippetRepository::getSnippets