PHP Class Sulu\Bundle\SnippetBundle\Snippet\SnippetRepository

Responsible for retrieving snippets from the content repository
Datei anzeigen Open project: sulu/sulu Class Usage Examples

Public Methods

Method Description
__construct ( SessionManager $sessionManager, ContentMapper $contentMapper, Sulu\Component\DocumentManager\DocumentManager $documentManager )
copyLocale ( string $uuid, integer $userId, string $srcLocale, string $destLocales ) : SnippetBridge Copy snippet from src-locale to dest-locale.
getReferences ( string $uuid ) : PHPCR\NodeInterface[] Return the nodes which refer to the structure with the given UUID.
getSnippets ( string $locale, string $type = null, integer $offset = null, integer $max = null, string $search = null, string $sortBy = null, string $sortOrder = null ) : SnippetBridge[] Return snippets.
getSnippetsAmount ( string $locale, string $type = null, string $search = null, string $sortBy = null, string $sortOrder = null ) : SnippetBridge[] Return snippets amount.
getSnippetsByUuids ( array $uuids, string $locale, boolean $loadGhostContent = false ) : SnippetDocument Return snippets identified by the given UUIDs.

Private Methods

Method Description
getSnippetsQuery ( string $locale, string $type = null, integer $offset = null, integer $max = null, string $search = null, string $sortBy = null, string $sortOrder = null ) : Query Return snippets load query.

Method Details

__construct() public method

public __construct ( SessionManager $sessionManager, ContentMapper $contentMapper, Sulu\Component\DocumentManager\DocumentManager $documentManager )
$sessionManager Sulu\Component\PHPCR\SessionManager\SessionManager
$contentMapper Sulu\Component\Content\Mapper\ContentMapper
$documentManager Sulu\Component\DocumentManager\DocumentManager

copyLocale() public method

TODO: We currently need the content mapper to copy the locale, it should be removed, see https://github.com/sulu-io/sulu/issues/1998
public copyLocale ( string $uuid, integer $userId, string $srcLocale, string $destLocales ) : SnippetBridge
$uuid string
$userId integer
$srcLocale string
$destLocales string
return Sulu\Component\Content\Compat\Structure\SnippetBridge

getReferences() public method

Return the nodes which refer to the structure with the given UUID.
public getReferences ( string $uuid ) : PHPCR\NodeInterface[]
$uuid string
return PHPCR\NodeInterface[]

getSnippets() public method

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
return Sulu\Component\Content\Compat\Structure\SnippetBridge[]

getSnippetsAmount() public method

If $type is given then only return the snippets of that type.
public getSnippetsAmount ( string $locale, string $type = null, string $search = null, string $sortBy = null, string $sortOrder = null ) : SnippetBridge[]
$locale string
$type string Optional snippet type
$search string
$sortBy string
$sortOrder string
return Sulu\Component\Content\Compat\Structure\SnippetBridge[]

getSnippetsByUuids() public method

UUIDs which fail to resolve to a snippet will be ignored.
public getSnippetsByUuids ( array $uuids, string $locale, boolean $loadGhostContent = false ) : SnippetDocument
$uuids array
$locale string
$loadGhostContent boolean
return Sulu\Bundle\SnippetBundle\Document\SnippetDocument