mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Restored methods in repositories
This commit is contained in:
@@ -12,4 +12,30 @@ use Doctrine\ORM\EntityRepository;
|
|||||||
*/
|
*/
|
||||||
class FeedEntryRepository extends EntityRepository
|
class FeedEntryRepository extends EntityRepository
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Returns a collection of FeedEntry from given feeds, limited to $how_many results, starting with $offset_start
|
||||||
|
*
|
||||||
|
* @param array $feeds
|
||||||
|
* @param integer $offset_start
|
||||||
|
* @param integer $how_many
|
||||||
|
*
|
||||||
|
* @return \Doctrine\Common\Collections\Collection
|
||||||
|
*/
|
||||||
|
public function findByFeeds($feeds, $offset_start = null, $how_many = null)
|
||||||
|
{
|
||||||
|
$dql = 'SELECT f FROM Entities\FeedEntry f
|
||||||
|
WHERE f.feed IN (:feeds) order by f.updatedOn DESC';
|
||||||
|
|
||||||
|
$query = $this->_em->createQuery($dql);
|
||||||
|
$query->setParameter('feeds', $feeds);
|
||||||
|
|
||||||
|
if (null !== $offset_start && 0 !== $offset_start) {
|
||||||
|
$query->setFirstResult($offset_start);
|
||||||
|
}
|
||||||
|
if (null !== $how_many) {
|
||||||
|
$query->setMaxResults($how_many);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->getResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,31 +25,15 @@ class FeedRepository extends EntityRepository
|
|||||||
$base_ids = array_keys($user->ACL()->get_granted_base());
|
$base_ids = array_keys($user->ACL()->get_granted_base());
|
||||||
|
|
||||||
$dql = 'SELECT f FROM Entities\Feed f
|
$dql = 'SELECT f FROM Entities\Feed f
|
||||||
WHERE f.base_id IS NULL ';
|
WHERE f.baseId IS NULL ';
|
||||||
|
|
||||||
if (count($base_ids) > 0) {
|
if (count($base_ids) > 0) {
|
||||||
$dql .= ' OR f.base_id
|
$dql .= ' OR f.baseId
|
||||||
IN (' . implode(', ', $base_ids) . ') ';
|
IN (' . implode(', ', $base_ids) . ') ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$dql .= ' OR f.public = true
|
$dql .= ' OR f.public = true
|
||||||
ORDER BY f.updated_on DESC';
|
ORDER BY f.updatedOn DESC';
|
||||||
|
|
||||||
$query = $this->_em->createQuery($dql);
|
|
||||||
|
|
||||||
return $query->getResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all the public feeds.
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function findAllPublic()
|
|
||||||
{
|
|
||||||
$dql = 'SELECT f FROM Entities\Feed f
|
|
||||||
WHERE f.public = true
|
|
||||||
ORDER BY f.updated_on DESC';
|
|
||||||
|
|
||||||
$query = $this->_em->createQuery($dql);
|
$query = $this->_em->createQuery($dql);
|
||||||
|
|
||||||
@@ -88,7 +72,7 @@ class FeedRepository extends EntityRepository
|
|||||||
public function findByIdArray(array $feed_id)
|
public function findByIdArray(array $feed_id)
|
||||||
{
|
{
|
||||||
$dql = 'SELECT f FROM Entities\Feed f
|
$dql = 'SELECT f FROM Entities\Feed f
|
||||||
ORDER BY f.created_on DESC
|
ORDER BY f.createdOn DESC
|
||||||
WHERE f.id IN (' . implode(",", $feed_id) . ')';
|
WHERE f.id IN (' . implode(",", $feed_id) . ')';
|
||||||
|
|
||||||
$query = $this->_em->createQuery($dql);
|
$query = $this->_em->createQuery($dql);
|
||||||
|
Reference in New Issue
Block a user