mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 20:43:25 +00:00
40 lines
800 B
PHP
40 lines
800 B
PHP
<?php
|
|
|
|
namespace Repositories;
|
|
|
|
use Doctrine\ORM\EntityRepository;
|
|
|
|
/**
|
|
* UsrListOwnerRepository
|
|
*
|
|
* This class was generated by the Doctrine ORM. Add your own custom
|
|
* repository methods below.
|
|
*/
|
|
class UsrListOwnerRepository extends EntityRepository
|
|
{
|
|
/**
|
|
*
|
|
*
|
|
* @param \Entities\UsrList $list
|
|
* @param type $owner_id
|
|
* @return \Entities\UsrList
|
|
*/
|
|
public function findByListAndOwner(\Entities\UsrList $list, $owner_id)
|
|
{
|
|
$owner = $this->find($owner_id);
|
|
|
|
/* @var $owner \Entities\UsrListOwner */
|
|
if (null === $owner)
|
|
{
|
|
throw new \Exception_NotFound(_('Owner is not found'));
|
|
}
|
|
|
|
if (!$owner->getList()->getid() != $list->getId())
|
|
{
|
|
throw new \Exception_Forbidden(_('Owner and list mismatch'));
|
|
}
|
|
|
|
return $owner;
|
|
}
|
|
|
|
} |