Guest User

Untitled

a guest
Jul 30th, 2015
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1.     public function findOneByIdJoinedToCategory($id)
  2.     {
  3.         $query = $this->getEntityManager()
  4.             ->createQuery(
  5.                 'SELECT p, c FROM BloggerBlogBundle:Post p
  6.                JOIN p.category c
  7.                WHERE p.id = :id'
  8.             )->setParameter('id', $id);
  9.  
  10.         try {
  11.             return $query->getSingleResult();
  12.         } catch (\Doctrine\ORM\NoResultException $e) {
  13.             return null;
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment