ElementTagsPropositionRepository.php 768B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Muzich\CoreBundle\Repository;
  3. use Doctrine\ORM\EntityRepository;
  4. class ElementTagsPropositionRepository extends EntityRepository
  5. {
  6. public function findByElement($element_id)
  7. {
  8. return $this->getEntityManager()
  9. ->createQuery('SELECT p FROM MuzichCoreBundle:ElementTagsProposition p
  10. JOIN p.user u
  11. JOIN p.tags t
  12. WHERE p.element = :eid')
  13. ->setParameter('eid', $element_id)
  14. ->getResult()
  15. ;
  16. }
  17. public function findOneById($id)
  18. {
  19. return $this->getEntityManager()
  20. ->createQuery('SELECT p FROM MuzichCoreBundle:ElementTagsProposition p
  21. JOIN p.element e
  22. JOIN p.tags t
  23. WHERE p.id = :id')
  24. ->setParameter('id', $id)
  25. ->getSingleResult()
  26. ;
  27. }
  28. }