Implement Doctrine feeds instead of Phrasea ones in the /list/ route

This commit is contained in:
Andrey
2013-05-07 15:44:28 +02:00
parent c53017b1ab
commit b7f4f209fc
4 changed files with 374 additions and 13 deletions

View File

@@ -2,6 +2,7 @@
namespace Repositories;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\EntityRepository;
/**
@@ -12,4 +13,31 @@ use Doctrine\ORM\EntityRepository;
*/
class SessionRepository extends EntityRepository
{
/**
*
* @param Application $app
* @param User_Adapter $user
* @return \Doctrine\Common\Collections\Collection
*/
public function getAllForUser(\User_Adapter $user)
{
$base_ids = array_keys($user->ACL()->get_granted_base());
$dql = 'SELECT f FROM Entities\Feed f
WHERE f.base_id IS NULL ';
if (count($base_ids) > 0) {
$dql .= ' OR f.base_id
IN (' . implode(', ', $base_ids) . ') ';
}
$dql .= ' OR f.public = true
ORDER BY f.created DESC';
$query = $this->_em->createQuery($dql);
$feeds = $query->getResult();
return $feeds;
}
}