Skip to content

Instantly share code, notes, and snippets.

@pulse00
Created May 24, 2012 07:27
Show Gist options
  • Save pulse00/2780022 to your computer and use it in GitHub Desktop.
Save pulse00/2780022 to your computer and use it in GitHub Desktop.
<?php
$filter->add('editor', 'doctrine_orm_callback', array(
'field_type'=> 'text',
'callback' => function($queryBuilder, $alias, $field, $value) {
$val = $value['value'];
if(!$value || strlen($val) <= 0){
return;
}
$queryBuilder->leftJoin(sprintf('%s.editors', $alias), 'e');
$queryBuilder->leftJoin(sprintf('e.editor', $alias), 'ed');
$queryBuilder->andWhere('ed.name LIKE = :name');
$queryBuilder->setParameter('name', '%' . $val . '%');
return true;
}
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment