2019-01-09 22:29:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Wallabag\ApiBundle\Repository;
|
|
|
|
|
2022-08-27 21:01:09 +00:00
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
|
|
use Doctrine\Persistence\ManagerRegistry;
|
|
|
|
use Wallabag\ApiBundle\Entity\Client;
|
2019-01-09 22:29:30 +00:00
|
|
|
|
2022-11-23 14:51:33 +00:00
|
|
|
/**
|
|
|
|
* @method Client[] findByUser(int $userId)
|
|
|
|
*/
|
2022-08-27 21:01:09 +00:00
|
|
|
class ClientRepository extends ServiceEntityRepository
|
2019-01-09 22:29:30 +00:00
|
|
|
{
|
2022-08-27 21:01:09 +00:00
|
|
|
public function __construct(ManagerRegistry $registry)
|
|
|
|
{
|
|
|
|
parent::__construct($registry, Client::class);
|
|
|
|
}
|
|
|
|
|
2019-01-09 22:29:30 +00:00
|
|
|
public function findOneBy(array $criteria, array $orderBy = null)
|
|
|
|
{
|
|
|
|
if (!empty($criteria['id'])) {
|
|
|
|
// cast client id to be an integer to avoid postgres error:
|
|
|
|
// "invalid input syntax for integer"
|
|
|
|
$criteria['id'] = (int) $criteria['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::findOneBy($criteria, $orderBy);
|
|
|
|
}
|
|
|
|
}
|