Skip to content

Instantly share code, notes, and snippets.

@shmaltorhbooks
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save shmaltorhbooks/bb7ddc58b7b01ed82f3d to your computer and use it in GitHub Desktop.

Select an option

Save shmaltorhbooks/bb7ddc58b7b01ed82f3d to your computer and use it in GitHub Desktop.
<?php
$filter = 'foo';
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('u');
$qb->from($this->getClassName() , 'u');
$qb->add('where', $qb->expr()->orx(
$qb->expr()->like('u.email', $qb->expr()->literal('%'.$filter.'%')),
$qb->expr()->like('u.name', $qb->expr()->literal('%'.$filter.'%'))
));
$query = $qb->getQuery();
$query->useResultCache(true, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment