Rapsys Git
/
airbundle
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Force cast of simple xml element to string
[airbundle]
/
Repository
/
SnippetRepository.php
diff --git
a/Repository/SnippetRepository.php
b/Repository/SnippetRepository.php
index a1d696b720f9856987ad7f3f684c0706e63cd2df..3d53487c22901fd3089dd1fd5bee8cb3c3241c2e 100644
(file)
--- a/
Repository/SnippetRepository.php
+++ b/
Repository/SnippetRepository.php
@@
-1,27
+1,33
@@
-<?php
+<?php
declare(strict_types=1);
-namespace Rapsys\AirBundle\Repository;
+/*
+ * This file is part of the Rapsys AirBundle package.
+ *
+ * (c) Raphaël Gertz <symfony@rapsys.eu>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
-use Symfony\Component\Translation\TranslatorInterface;
-use Doctrine\ORM\Query\ResultSetMapping;
+namespace Rapsys\AirBundle\Repository;
/**
* SnippetRepository
*/
class SnippetRepository extends \Doctrine\ORM\EntityRepository {
/**
/**
* SnippetRepository
*/
class SnippetRepository extends \Doctrine\ORM\EntityRepository {
/**
- * Find snippets by
locale and user
id
+ * Find snippets by
user id, locale and index by location
id
*
*
+ * @param int $user The user
* @param string $locale The locale
* @param string $locale The locale
- * @param User|int $user The user
- * @return array The snippets or empty array
+ * @return array The snippets array
*/
*/
- public function findBy
LocaleUserId($locale, $user)
{
+ public function findBy
UserIdLocaleIndexByLocationId(int $userId, string $locale): array
{
//Fetch snippets
//Fetch snippets
- $ret = $this->getEntityManager()
- ->createQuery('SELECT s FROM RapsysAirBundle:Snippet s WHERE s.locale = :locale and s.user = :user')
+ $ret = $this->_em
+ ->createQuery('SELECT s FROM Rapsys\AirBundle\Entity\Snippet s INDEX BY s.location WHERE s.locale = :locale and s.user = :user')
+ ->setParameter('user', $userId)
->setParameter('locale', $locale)
->setParameter('locale', $locale)
- ->setParameter('user', $user)
->getResult();
//Send result
->getResult();
//Send result