Fix latest merge

This commit is contained in:
Nicolas Le Goff
2014-03-30 21:17:46 +02:00
parent e97ed2b3f1
commit 1054483ae9
5 changed files with 10 additions and 5 deletions

1
composer.lock generated
View File

@@ -1426,7 +1426,6 @@
"export",
"import"
],
"time": "2013-11-22 19:10:34"
"time": "2014-01-12 16:34:06"
},
{

View File

@@ -1426,7 +1426,9 @@ class V1 implements ControllerProviderInterface
public function get_publications(Application $app, Request $request)
{
$user = $app['authentication']->getUser();
$feed = Aggregate::createFromUser($app, $user);
$restrictions = (array) ($request->get('feeds') ? : array());
$feed = Aggregate::createFromUser($app, $user, $restrictions);
$offset_start = (int) ($request->get('offset_start') ? : 0);
$per_page = (int) ($request->get('per_page') ? : 5);

View File

@@ -495,7 +495,7 @@ class Informations implements ControllerProviderInterface
'rs' => $html,
'display_nav' => false,
'title' => $title
));
]);
}
/**

View File

@@ -76,7 +76,7 @@ class Aggregate implements FeedInterface
*
* @return Aggregate
*/
public static function createFromUser(Application $app, User $user)
public static function createFromUser(Application $app, User $user, array $restrictions = [])
{
$feeds = $app['repo.feeds']->getAllForUser($app['acl']->get($user));
$token = $app['repo.aggregate-tokens']->findOneBy(['user' => $user]);

View File

@@ -26,7 +26,7 @@ class FeedRepository extends EntityRepository
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getAllForUser(\ACL $userACL)
public function getAllForUser(\ACL $userACL, array $restrictions = [])
{
$base_ids = array_keys($userACL->get_granted_base());
@@ -40,6 +40,10 @@ class FeedRepository extends EntityRepository
$qb->orWhere($qb->expr()->in('f.baseId', $base_ids));
}
if (count($restrictions) > 0) {
$qb->andWhere($qb->expr()->in('f.id', $restrictions));
}
$qb->orderBy('f.updatedOn', 'DESC');
return $qb->getQuery()->getResult();