mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
PHPCS in BasketRepository
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Model\Repositories;
|
|||||||
use Alchemy\Phrasea\Model\Entities\Basket;
|
use Alchemy\Phrasea\Model\Entities\Basket;
|
||||||
use Alchemy\Phrasea\Model\Entities\User;
|
use Alchemy\Phrasea\Model\Entities\User;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Symfony\Component\Translation\TranslatorInterface;
|
use Symfony\Component\Translation\TranslatorInterface;
|
||||||
@@ -145,7 +146,7 @@ class BasketRepository extends EntityRepository
|
|||||||
*
|
*
|
||||||
* @throws NotFoundHttpException
|
* @throws NotFoundHttpException
|
||||||
* @throws AccessDeniedHttpException
|
* @throws AccessDeniedHttpException
|
||||||
* @param type $basket_id
|
* @param int $basket_id
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @return Basket
|
* @return Basket
|
||||||
*/
|
*/
|
||||||
@@ -207,8 +208,6 @@ class BasketRepository extends EntityRepository
|
|||||||
|
|
||||||
public function findWorkzoneBasket(User $user, $query, $year, $type, $offset, $perPage)
|
public function findWorkzoneBasket(User $user, $query, $year, $type, $offset, $perPage)
|
||||||
{
|
{
|
||||||
$params = [];
|
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::RECEIVED:
|
case self::RECEIVED:
|
||||||
$dql = 'SELECT b
|
$dql = 'SELECT b
|
||||||
@@ -241,18 +240,6 @@ class BasketRepository extends EntityRepository
|
|||||||
'usr_id' => $user->getId()
|
'usr_id' => $user->getId()
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
$dql = 'SELECT b
|
|
||||||
FROM Phraseanet:Basket b
|
|
||||||
LEFT JOIN b.elements e
|
|
||||||
LEFT JOIN b.validation s
|
|
||||||
LEFT JOIN s.participants p
|
|
||||||
WHERE (b.user = :usr_id OR p.user = :validating_usr_id)';
|
|
||||||
$params = [
|
|
||||||
'usr_id' => $user->getId(),
|
|
||||||
'validating_usr_id' => $user->getId()
|
|
||||||
];
|
|
||||||
break;
|
|
||||||
case self::MYBASKETS:
|
case self::MYBASKETS:
|
||||||
$dql = 'SELECT b
|
$dql = 'SELECT b
|
||||||
FROM Phraseanet:Basket b
|
FROM Phraseanet:Basket b
|
||||||
@@ -264,6 +251,17 @@ class BasketRepository extends EntityRepository
|
|||||||
'usr_id' => $user->getId()
|
'usr_id' => $user->getId()
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
$dql = 'SELECT b
|
||||||
|
FROM Phraseanet:Basket b
|
||||||
|
LEFT JOIN b.elements e
|
||||||
|
LEFT JOIN b.validation s
|
||||||
|
LEFT JOIN s.participants p
|
||||||
|
WHERE (b.user = :usr_id OR p.user = :validating_usr_id)';
|
||||||
|
$params = [
|
||||||
|
'usr_id' => $user->getId(),
|
||||||
|
'validating_usr_id' => $user->getId()
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctype_digit($year) && strlen($year) == 4) {
|
if (ctype_digit($year) && strlen($year) == 4) {
|
||||||
@@ -287,9 +285,7 @@ class BasketRepository extends EntityRepository
|
|||||||
->setFirstResult($offset)
|
->setFirstResult($offset)
|
||||||
->setMaxResults($perPage);
|
->setMaxResults($perPage);
|
||||||
|
|
||||||
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($query, true);
|
return new Paginator($query, true);
|
||||||
|
|
||||||
return $paginator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user