예제 #1
0
 /**
  * showTagArticlesAction
  * Show articles containing one tag or category
  * @param \Gore\BlogBundle\Controller\Keyword $keyword
  */
 public function showTagArticlesAction(Keyword $keyword = null)
 {
     if ($keyword === null) {
         return $this->showSearchPage();
     }
     return $this->showSearchPage($keyword->getArticles(), $keyword->getName());
 }
예제 #2
0
 /**
  * getKeywordIfExists
  * Check if a keyword exists in DB
  * NOTE : the Keyword in parameter is not a DB Keyword but a Keyword
  * created by the form->bind() ; id doesn't have any ID yet
  * @param \Gore\BlogBundle\Entity\Keyword $keyword
  * @return null if there is 0 et many keywords with this name ; the 
  * keyword if it's alone in the DB
  */
 public function getKeywordIfExists(Keyword $keyword)
 {
     $qb = $this->createQueryBuilder('k')->where('k.category = false')->where('k.name = :name')->setParameter('name', $keyword->getName());
     return $qb->getQuery()->getOneOrNullResult();
 }