I'm using a custom query to customize records displayed in sfWidgetFormDoctrineChoice. It looks like that:
$query = Doctrine_Query::create();
$query->from('Type a')
->leftJoin('a.Parents p')
->addWhere('p.id = ?', 12345);
(it is a table with self-referenced Parents and Children)
The same query I want to use in validator sfValidatorDoctrineChoice. But it throws an exception because this validator replaces "from" and "leftJoin" with its own so my "where" fails (there is no "p" alias). It creates query like that: "FROM Type a WHERE p.id = ? AND a.id = ?" (replaced from, but where still exists)
This behaviour is different to widgets and sfValidatorDoctrineChoiceMany where "from" is attached only when no custom query is provided. See my patch and compare differences.
IMO there is also a small issue in sfValidatorDoctrineChoiceMany. Custom query behaviour is good here, but there is "whereIn" instead of "addWhereIn" so it overwrites all "wheres" from custom query.