Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. $qb = $this->createQueryBuilder('u');
  2. $qb->select(array('u,c'))
  3. ->innerJoin('u.Entities\Client','c');
  4. if (!preg_match('/^\d+$/', $client_id)){
  5. $qb->where($qb->expr()->like('u.client_id',':client_id'));
  6. $client_id = '%'.$client_id.'%';
  7. } else {
  8. $qb->where('u.client_id = :client_id');
  9. }
  10. $qb->andWhere('u.username = :username')
  11. ->andWhere('u.password = :password')
  12. ->setParameters(
  13. array(
  14. 'client_id' => $client_id,
  15. 'username' => $username,
  16. 'password' => $password
  17. )
  18. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement