for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AppBundle\Repository;
use Doctrine\ORM\Query;
use AppBundle\Entity\DTO\Filter;
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
/**
* UserRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class UserRepository extends \Doctrine\ORM\EntityRepository implements UserLoaderInterface
{
public function loadUserByUsername($username)
return $this->createQueryBuilder('user')
->andWhere('user.apiToken = :username')
->setParameter('username', $username)
->getQuery()
->getOneOrNullResult();
}
* @param Filter $filter
* @return Query
public function selectUsersByParams(Filter $filter):Query
$postsQuery = $this->createQueryBuilder('u');
if ($filter->name) {
$postsQuery->where(
$postsQuery->expr()->like('u.firstName', ':name')
)
->orWhere(
$postsQuery->expr()->like('u.lastName', ':name')
$postsQuery->expr()->like('u.email', ':name')
->setParameter('name', '%'.$filter->name.'%');
return $postsQuery->getQuery();
public function selectNotBlocked()
return $this->createQueryBuilder('u')
->andWhere('u.enabled = TRUE')
->orderBy('u.lastName')
->getResult();