views:

124

answers:

1

I have a genereated form which handles a m:n relation. The generated form overrides the doSave() method to handle the "list".

If I embed this Form in an other the special doSave() mothod is never called. The result is that everything works fine except that the m:n relation isn't stored.

Do I have to handle the m:n relation manuel?

Thanks

A: 

The better using sf 1.4 is using in your form class

public function configure() {
    $this->embedRelation('relationName'); 
    //other configuration
}

This work 'as this' for update/insert operations but your model relationship definition must be clear.

For further relation integration, you can override sfForm or sfDoctrineForm methods (especially doBind, doUpdateObject, saveEmbeddedForms) to add selective deletion, specific data binding, etc.

A good arcticle on this topic can be found here It is symfony 1.3 but the same pattens applies.

The good argument for this kind of implementation is that you have nothing to change in your module's actions.class.php and thus avoid creating dependency on form with its (or their) associated module.

Benoit