Sorry for the line break mess... Tim On 18 Nov., 14:28, Tim Richter <[email protected]> wrote: > Hello, > > sorry if this ML is the wrong place for the following: > > Symfony is great, just started using it. One annoyance: If I mark the > "is_empty" checkbox near a > filter for a text field in the list view of admin generated module, I > expect to find the Records where > the particular field is empty. Although I know to have some of these, > nothing matches. I had a look > at the code and found that "is_empty" actually adds a "WHERE a.b IS > NULL" clause. This is not what > "is_empty" suggests. I think function addTextQuery in > lib/plugins/sfDoctrinePlugin/lib/form/sfFormFilterDoctrine.class.php > should be patched: > > <code> > protected function addTextQuery(Doctrine_Query $query, $field, > $values) > { > $fieldName = $this->getFieldName($field); > > if (is_array($values) && isset($values['is_empty']) && $values > ['is_empty']) > { > - $query->addWhere(sprintf("%s.%s IS NULL", $query->getRootAlias > (), $fieldName)); > + $query->addWhere(sprintf("(%s.%s IS NULL OR %s.%s='')", > $query->getRootAlias(), $fieldName, $query->getRootAlias(), $fieldName)); > > } > else if (is_array($values) && isset($values['text']) && '' != > $values['text']) > { > $query->addWhere(sprintf('%s.%s LIKE ?', $query->getRootAlias(), > $fieldName), '%'.$values['text'].'%'); > } > } > </code> > > If the current behaviour is by design, please give an explanation. The > code above works for me > using symfony 1.2.9 with the bundled Doctrine plugin. I have checked > SVN of branches 1.2, 1.3 and 1.4 > for changes to addTextQuery, but this function is the same everywhere. > > Best regards, > Tim Richter
-- You received this message because you are subscribed to the Google Groups "symfony developers" 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-devs?hl=.
