mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Fix usrlist unit tests
This commit is contained in:
@@ -12,6 +12,7 @@ use Doctrine\ORM\EntityRepository;
|
||||
*/
|
||||
class UsrListOwnerRepository extends EntityRepository
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
@@ -37,4 +38,36 @@ class UsrListOwnerRepository extends EntityRepository
|
||||
return $owner;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param \Entities\UsrList $list
|
||||
* @param type $usr_id
|
||||
* @return \Entities\UsrList
|
||||
*/
|
||||
public function findByListAndUsrId(\Entities\UsrList $list, $usr_id)
|
||||
{
|
||||
$dql = 'SELECT o FROM Entities\UsrListOwner o
|
||||
JOIN o.list l
|
||||
WHERE l.id = :list_id AND o.usr_id = :usr_id';
|
||||
|
||||
$params = array(
|
||||
'usr_id' => $usr_id,
|
||||
'list_id' => $list->getId()
|
||||
);
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters($params);
|
||||
|
||||
$owner = $query->getSingleResult();
|
||||
|
||||
/* @var $owner \Entities\UsrListOwner */
|
||||
if (null === $owner)
|
||||
{
|
||||
throw new \Exception_NotFound(_('Owner is not found'));
|
||||
}
|
||||
|
||||
return $owner;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user