1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys AirBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\AirBundle\Repository
;
17 class SnippetRepository
extends \Doctrine\ORM\EntityRepository
{
19 * Find snippets by user id, locale and index by location id
21 * @param int $user The user
22 * @param string $locale The locale
23 * @return array The snippets array
25 public function findByUserIdLocaleIndexByLocationId(int $userId, string $locale): array {
28 ->createQuery('SELECT s FROM Rapsys\AirBundle\Entity\Snippet s INDEX BY s.location WHERE s.locale = :locale and s.user = :user')
29 ->setParameter('user', $userId)
30 ->setParameter('locale', $locale)