]> Raphaƫl G. Git Repositories - airbundle/blob - Repository/SnippetRepository.php
Add donate, link and profile fields
[airbundle] / Repository / SnippetRepository.php
1 <?php
2
3 namespace Rapsys\AirBundle\Repository;
4
5 use Symfony\Component\Translation\TranslatorInterface;
6 use Doctrine\ORM\Query\ResultSetMapping;
7
8 /**
9 * SnippetRepository
10 */
11 class SnippetRepository extends \Doctrine\ORM\EntityRepository {
12 /**
13 * Find snippets by locale and user id
14 *
15 * @param string $locale The locale
16 * @param User|int $user The user
17 * @return array The snippets or empty array
18 */
19 public function findByLocaleUserId($locale, $user) {
20 //Fetch snippets
21 $ret = $this->getEntityManager()
22 ->createQuery('SELECT s FROM RapsysAirBundle:Snippet s WHERE s.locale = :locale and s.user = :user')
23 ->setParameter('locale', $locale)
24 ->setParameter('user', $user)
25 ->getResult();
26
27 //Send result
28 return $ret;
29 }
30 }