I don't think that you need embed form filter. Just add a widget for selecting a school into the person formFilter Something like:
public function configure() { $this->widgetSchema['school_id'] = new sfWidgetFormDoctrineChoice(array( 'model' => $this->getRelatedModelName('School'), 'method' => 'myMethodForWhatIWhant', 'add_empty' => true )); $this->validatorSchema['school_id']..... } Then add this field to the filter, and set that it will have cutom method for creating the query public function getFields() { $fields = parent::getFields(); $fields['school_id'] = 'custom'; return $fields; } Then create the method for altering the query for the filter This is my method for i18n join, so modify this for your WHERE query. You can look into the sfFormFilterDoctrine class, method addForeignKeyQuery. Maybe you can use directly this method from the sfFormFilterDoctrine.... you can try to not creating the custom method - in the getFields method set type to ForeignKey (maybe foreign_key..) $fields['school_id'] = 'ForeignKey'; public function addSchoolIdColumnQuery($query, $field, $values) { $fieldName = 'title'; $translationAlias = 't'; // Must by the same as in the table_method //$query->leftJoin(sprintf('%s.%s %s', $query->getRootAlias(), 'Translation', $translationAlias)); // Translations already joined in table_method generator settings //echo $query->contains('Translation t'); if (is_array($values) && isset($values['is_empty']) && $values['is_empty']) { $query->addWhere(sprintf('(%s.%s IS NULL OR %1$s.%2$s = ?)', $translationAlias, $fieldName), array('')); } else if (is_array($values) && isset($values['text']) && '' != $values['text']) { $query->addWhere(sprintf('%s.%s LIKE ?', $translationAlias, $fieldName), '%'.$values['text'].'%'); } } On 10 srp, 11:23, "Sebastien Armand [Pink]" <khe...@gmail.com> wrote: > Actually I don't think what I'm looking for is a join, but a set of WHERE > conditions like: > > WHERE person.school_id IN (SELECT school.id FROM School WHERE city = paris) > > still no clue how to get that though! > > 2010/8/10 Sebastien Armand [Pink] <khe...@gmail.com> > > > > > Hello everyone! > > > New day new issue! > > > let's imagine the following model: > > > person: > > name: > > nickname: > > school_id: > > > school: > > name: > > city: > > > I want to have a filter on 'person' to browse through the person database. > > And in that filter I want to be able to choose the city they studied in. > > > What I did so far is: > > use the standard PersonFormFilter, this works like a charm, no problem > > embed a SchoolFormFilter in the PersonFormFilter > > > when doing so, the first problem appears: while binding the > > PersonFormFilter to its values, the embedded form will not be bound to > > anything. > > If trying to bind it separately, I get a csrf error because no csrf token > > is included in the values for the school. Adding it manually only brings up > > a csrf attack detection. > > > So disabled the CSRF protection on the embedded form. > > > Now I can get my 2 filters and get a look at the queries generated. What > > would be wonderful from now is to be able to build a join of those 2 > > queries. > > > However, the 2 queries being built independently, they are using the same > > alias: 'r' which causes a conflict. > > > Also it seems a pretty complicated way to work, anyone knows of a better / > > much more simple and clean solution, or at least can help me going forward? -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en