mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-08 18:44:30 +00:00

PHRAS-3223 * add auth failure tab * auth provider list * api oauth code list * fix limit * delete modificaiton date * add mail locked only filter * add badge on api list
38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\Model\Repositories;
|
|
|
|
use Alchemy\Phrasea\Model\Entities\ApiAccount;
|
|
use Alchemy\Phrasea\Model\Entities\User;
|
|
use Doctrine\ORM\EntityRepository;
|
|
use Doctrine\ORM\Query\Expr;
|
|
|
|
/**
|
|
* ApiOauthCodeRepository
|
|
*
|
|
* This class was generated by the Doctrine ORM. Add your own custom
|
|
* repository methods below.
|
|
*/
|
|
class ApiOauthCodeRepository extends EntityRepository
|
|
{
|
|
public function findByAccount(ApiAccount $account)
|
|
{
|
|
$qb = $this->createQueryBuilder('c');
|
|
$qb->where($qb->expr()->eq('c.account', ':account'));
|
|
$qb->setParameter(':account', $account);
|
|
|
|
return $qb->getQuery()->getResult();
|
|
}
|
|
|
|
public function findByUserAccount(User $user, $limit = 50)
|
|
{
|
|
$qb = $this->createQueryBuilder('c');
|
|
$qb->innerJoin('c.account', 'acc', Expr\Join::WITH, $qb->expr()->eq('acc.user', ':user'));
|
|
$qb->setMaxResults($limit)
|
|
->orderBy('c.created', 'DESC');
|
|
$qb->setParameter(':user', $user);
|
|
|
|
return $qb->getQuery()->getResult();
|
|
}
|
|
}
|