mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 19:43:16 +00:00
30 lines
893 B
PHP
30 lines
893 B
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\Model\Repositories;
|
|
|
|
use Alchemy\Phrasea\Model\Entities\ApiAccount;
|
|
use Doctrine\ORM\EntityRepository;
|
|
use Doctrine\ORM\Query\Expr;
|
|
|
|
/**
|
|
* ApiOauthTokenRepository
|
|
*
|
|
* This class was generated by the Doctrine ORM. Add your own custom
|
|
* repository methods below.
|
|
*/
|
|
class ApiOauthTokenRepository extends EntityRepository
|
|
{
|
|
public function findDeveloperToken(ApiAccount $account)
|
|
{
|
|
$qb = $this->createQueryBuilder('tok');
|
|
$qb->innerJoin('tok.account', 'acc', Expr\Join::WITH, $qb->expr()->eq('acc.id', ':acc_id'));
|
|
$qb->innerJoin('acc.application', 'app', Expr\Join::WITH, $qb->expr()->orx(
|
|
$qb->expr()->eq('app.creator', 'acc.user'),
|
|
$qb->expr()->isNull('app.creator')
|
|
));
|
|
$qb->setParameter(':acc_id', $account->getId());
|
|
|
|
return $qb->getQuery()->getOneOrNullResult();
|
|
}
|
|
}
|