Newscoop\Entity\Repository\SnippetRepository::getSnippetById PHP Метод

getSnippetById() публичный Метод

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'
Результат Newscoop\Entity\Snippet
    public function getSnippetById($id, $show = 'enabled', $template = true)
    {
        if (!is_numeric($id)) {
            throw new \InvalidArgumentException("ID is not numeric: " . $id);
        }
        $queryBuilder = $this->getSnippetQueryBuilder($show, $template)->andWhere('snippet.id = :id')->setParameter('id', $id);
        $result = $queryBuilder->getQuery()->getOneOrNullResult();
        return $this->checkIfSnippetIsDisabled($queryBuilder, $result, $show);
    }