Nobody filter a list by checkboxes or by a multiple selectbox?
On 11 led, 20:51, Tom Ptacnik <[email protected]> wrote: > Hello, > > I have classic admin generated backend (Symfony 1.4). Today I've tried > to customize the filter for the list view. > > The problem is that I want to filter by multiple select. So I've > changed default widgets in configure method in my TicketFormFilter > class from: > > 'tkstate' => new sfWidgetFormChoice(array('choices' => array('' => > '', 'new' => 'new', 'waitingforuser' => 'waitingforuser', > 'waitingforadmin' => 'waitingforadmin', 'closed' => 'closed', > 'deleted' => 'deleted'))), > > 'tkstate' => new sfValidatorChoice(array('required' => false, > 'choices' => array('new' => 'new', 'waitingforuser' => > 'waitingforuser', 'waitingforadmin' => 'waitingforadmin', 'closed' => > 'closed', 'deleted' => 'deleted'))), > > to > > $this->widgetSchema['tkstate'] = new sfWidgetFormChoice(array > ('choices' => array('' => '', 'new' => 'new', 'waitingforuser' => > 'waitingforuser', 'waitingforadmin' => 'waitingforadmin', 'closed' => > 'closed', 'deleted' => 'deleted'), 'multiple' => true)); > > $this->validatorSchema['tkstate'] = new sfValidatorChoice(array > ('required' => false, 'choices' => array('new' => 'new', > 'waitingforuser' => 'waitingforuser', 'waitingforadmin' => > 'waitingforadmin', 'closed' => 'closed', 'deleted' => 'deleted'), > 'multiple' => true)); > > ... only added the multiple parameter. > > But when i click on the "filter" submit (with two selected items: new, > waitingforuser), I got this error: > > stack trace > at () > in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib > \vendor\doctrine\Doctrine\Connection.php line 1082 ... > $message .= sprintf('. Failing Query: "%s"', $query); > } > $exc = new $name($message, (int) $e->getCode()); > > if ( ! isset($e->errorInfo) || ! is_array($e->errorInfo)) { > $e->errorInfo = array(null, null, null, null); > } > at Doctrine_Connection->rethrowException(object('PDOException'), object > ('Doctrine_Connection_Statement')) > in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib > \vendor\doctrine\Doctrine\Connection\Statement.php line 269 ... > at Doctrine_Connection_Statement->execute(array('new', > 'waitingforuser')) > in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib > \vendor\doctrine\Doctrine\Connection.php line 1006 ... > at Doctrine_Connection->execute('SELECT COUNT(*) AS num_results FROM > ticket t WHERE t.tkstate = ?', array('new', 'waitingforuser')) > in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib > \vendor\doctrine\Doctrine\Connection.php line 800 ... > at Doctrine_Connection->fetchAll('SELECT COUNT(*) AS num_results FROM > ticket t WHERE t.tkstate = ?', array('new', 'waitingforuser')) > in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib > \vendor\doctrine\Doctrine\Query.php line 2108 ... > > The problem seems to be in the generated query ... the should be OR > statement (for this multiple choice), but it looks that it's generated > classic simple WHERE, and as parameter is send whole array... and > doctrine is confused of course > > Maybe the problem is only in my application. > > Did anybody of you ever tried to filter by multiple select?
-- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
