Пример #1
0
 /**
  * Esta funcion solo sirve para select2 de cliente.
  * Se necesita tener un por ej: ->join('a.cliente', 'cli') indicar 'cli'
  * Y tambien ->select('a, cli') indicando nuevamente 'cli'
  */
 public function filterTextEntity(ApplyFilterEvent $event)
 {
     $qb = $event->getQueryBuilder();
     $values = $event->getValues();
     if (!is_null($values['value'])) {
         $qb->where('a.id = :id')->setParameter('id', $values['value']->getId())->getQuery()->getResult();
     }
 }
 public function filterTextEntity(ApplyFilterEvent $event)
 {
     $qb = $event->getQueryBuilder();
     $values = $event->getValues();
     if (!empty($values['value'])) {
         $qb->select('a', 'c')->leftJoin($event->getField(), 'c')->where('c.id = :id')->setParameter('id', $values['value']->getId())->orderBy('a.id', 'DESC')->getQuery()->getResult();
     }
 }
Пример #3
0
 /**
  * A listener for the filter type filterName.
  *
  * @param ApplyFilterEvent $event A LexikFormFilter event
  */
 public function filterName(ApplyFilterEvent $event)
 {
     $qb = $event->getQueryBuilder();
     $expr = $event->getFilterQuery()->getExpr();
     $values = $event->getValues();
     if (!empty($values['value'])) {
         $qb->andWhere($expr->orX()->add($expr->like('p.name', "'%" . $values['value'] . "%'")));
     }
 }
Пример #4
0
 public function filterText(ApplyFilterEvent $event)
 {
     $qb = $event->getQueryBuilder();
     $expr = $event->getFilterQuery()->getExpressionBuilder();
     $values = $event->getValues();
     if ('' !== $values['value'] && null !== $values['value']) {
         if (isset($values['condition_pattern'])) {
             $qb->andWhere($expr->stringLike($event->getField(), $values['value'], $values['condition_pattern']));
         } else {
             $qb->andWhere($expr->stringLike($event->getField(), $values['value']));
         }
     }
 }