PHP Class Newscoop\Entity\Repository\SnippetRepository

Inheritance: extends Doctrine\ORM\EntityRepository
Show file Open project: sourcefabric/newscoop

Public Methods

Method Description
addSnippetToArticle ( Snippet $snippet, Article $article )
deleteSnippet ( $id, $force = false )
findSnippetsByName ( string $name, string $show = 'enabled', boolean $fuzzy = false ) : Doctrine\ORM\Query Get Snippet by Name
findSnippetsByNameForArticle ( $articleNr, $languageCode, string $name, string $show = 'enabled', boolean $fuzzy = false ) : Doctrine\ORM\Query Get Snippet by Name
getArticleSnippets ( $articleNr, $languageCode, string $show = 'enabled' ) : Doctrine\ORM\Query Get Snippets for Article
getSnippetById ( integer $id, string $show = 'enabled', $template = true ) : Snippet Get Snippet
getSnippets ( string $show = 'enabled' ) : Doctrine\ORM\Query Get all Snippets
removeSnippetFromArticle ( Snippet $snippet, Article $article )
save ( Snippet $snippet )

Protected Methods

Method Description
checkIfSnippetIsDisabled ( Doctrine\ORM\QueryBuilder $queryBuilder, mixed $result, string $show ) Check if a Snippet is disabled Internal use only
getArticleSnippetQueryBuilder ( $articleNr, string $language, string $show ) : Doctrine\ORM\Querybuilder Convenience QueryBuilder for Snippets attached to an Article
getSnippetArticles ( integer $id ) : Doctrine\Common\Collections\ArrayCollection Get all the Articles attached to a Snippet
getSnippetQueryBuilder ( string $show, $templateEnabled = true ) : Doctrine\ORM\Querybuilder Convenience QueryBuilder for Snippets

Method Details

addSnippetToArticle() public method

public addSnippetToArticle ( Snippet $snippet, Article $article )
$snippet Newscoop\Entity\Snippet
$article Newscoop\Entity\Article

checkIfSnippetIsDisabled() protected method

Check if a Snippet is disabled Internal use only
protected checkIfSnippetIsDisabled ( Doctrine\ORM\QueryBuilder $queryBuilder, mixed $result, string $show )
$queryBuilder Doctrine\ORM\QueryBuilder
$result mixed
$show string

deleteSnippet() public method

public deleteSnippet ( $id, $force = false )

findSnippetsByName() public method

Get Snippet by Name
public findSnippetsByName ( string $name, string $show = 'enabled', boolean $fuzzy = false ) : Doctrine\ORM\Query
$name string Snippet Name
$show string Define which Snippets to return, 'enabled' | 'disabled' | 'all'
$fuzzy boolean Find fuzzy or not
return Doctrine\ORM\Query Query

findSnippetsByNameForArticle() public method

Get Snippet by Name
public findSnippetsByNameForArticle ( $articleNr, $languageCode, string $name, string $show = 'enabled', boolean $fuzzy = false ) : Doctrine\ORM\Query
$name string Snippet Name
$show string Define which Snippets to return, 'enabled' | 'disabled' | 'all'
$fuzzy boolean Find fuzzy or not
return Doctrine\ORM\Query Query

getArticleSnippetQueryBuilder() protected method

This internal function is used by almost all Repository functions, it allows for more consistency. The rest of the doc also applies to the functions using it. Returns all the associated Snippets to an Article. If the SnippetTemplate is disabled, the Snippets depending on it won't be returned. By Default all Snippets that are Disabled themselves are not returned.
protected getArticleSnippetQueryBuilder ( $articleNr, string $language, string $show ) : Doctrine\ORM\Querybuilder
$language string Language code in format "en" for example.
$show string Define which Snippets to return, 'enabled' | 'disabled' | 'all'
return Doctrine\ORM\Querybuilder $queryBuilder

getArticleSnippets() public method

Returns all the associated Snippets to an Article. If the SnippetTemplate is disabled, the Snippets depending on it won't be returned. By Default all Snippets that are Disabled themselves are not returned.
public getArticleSnippets ( $articleNr, $languageCode, string $show = 'enabled' ) : Doctrine\ORM\Query
$show string Define which Snippets to return, 'enabled' | 'disabled' | 'all'
return Doctrine\ORM\Query Query

getSnippetArticles() protected method

Get all the Articles attached to a Snippet
protected getSnippetArticles ( integer $id ) : Doctrine\Common\Collections\ArrayCollection
$id integer SnippetID
return Doctrine\Common\Collections\ArrayCollection

getSnippetById() public method

Get Snippet
public getSnippetById ( integer $id, string $show = 'enabled', $template = true ) : Snippet
$id integer Snippet ID
$show string Define which Snippets to return, 'enabled' | 'disabled' | 'all'
return Newscoop\Entity\Snippet

getSnippetQueryBuilder() protected method

This internal function is used by almost all Repository functions, it allows for more consistency. The rest of the doc also applies to the functions using it. Returns all Snippets. If the SnippetTemplate is disabled, the Snippets depending on it won't be returned. By Default all Snippets that are Disabled themselves are not returned.
protected getSnippetQueryBuilder ( string $show, $templateEnabled = true ) : Doctrine\ORM\Querybuilder
$show string Define which Snippets to return, 'enabled' | 'disabled' | 'all'
return Doctrine\ORM\Querybuilder $queryBuilder

getSnippets() public method

Returns all Snippets. If the SnippetTemplate is disabled, the Snippets depending on it won't be returned. By Default all Snippets that are Disabled themselves are not returned.
public getSnippets ( string $show = 'enabled' ) : Doctrine\ORM\Query
$show string Define which Snippets to return, 'enabled' | 'disabled' | 'all'
return Doctrine\ORM\Query Query

removeSnippetFromArticle() public method

public removeSnippetFromArticle ( Snippet $snippet, Article $article )
$snippet Newscoop\Entity\Snippet
$article Newscoop\Entity\Article

save() public method

public save ( Snippet $snippet )
$snippet Newscoop\Entity\Snippet