Fix usrlist unit tests

This commit is contained in:
Romain Neutron
2012-01-26 16:23:09 +01:00
parent 2850cc04bc
commit c2017a0399
3 changed files with 365 additions and 321 deletions

View File

@@ -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;
}
}