On Feb 17, 2:34 pm, Stéphane <stephane.er...@gmail.com> wrote: > Hi, > > In the BaseDoctrineForm, in the ::configure() method, I've coded something > like this: > > $aConditions = array('ajax'=>isAjax ? 'ajax:false, 'new'=> isNew ? 'new': > false, 'embedded'=>isEmbedded?'embedded':false, ....); > $method = sprintf('_computeFields%s%s%s', $aConds['ajax'], $aConds['new'], > $aConds['.....) > > and finally > try{ > $this->useFields($this->$method()); > > }catch(Exception $e){} > > So I can compute the correct method to call to configure the fields > according to the current situation. > > In the embedRelations, you can give args to the newed form class, this is > where you'll give to it "you are currently embedded" and why not pass it the > current embedding form and other needed stuffs. > > The main concern here is to make the form class able to determine "by > itself" how it should react to its external conditions, without having to > tell how it should act (what fields it should show, etc) everywhere in the > code. This make these available in some places (the > "_configureFields%s%s%s..' methods). You can even go further by making an > "order of precedence" (like ysfDimensionPlugin does in someway). > > So there is no more questions such as "where is it said that this form show > these fields ?", it's all in these methods of the concerned form. > > Hope this help, > > Cheers, > > Before Printing, Think about Your Environmental Responsibility! > Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale! > > On Wed, Feb 17, 2010 at 8:12 PM, Daniel Lohse > <annismcken...@googlemail.com>wrote: > > > Hey there, > > > there's only one way I can of, which you probably won't like. Just > > configure all the fields directly in the form. :) > > So, delete the form: display: key and just create another form inheriting > > from the form you are probably already using elsewhere and use > > $this->useFields() before calling this embedRelations(). > > > Does that help? By the way, you really shouldn't use the form: display: key > > as you are likely to get confused and forgot to update the generator.yml > > when new fields are added. This is also prevents a security hole.
I hope it will help but I must take some time to learn a bit more about these things. Anyway, thanks a lot ! Regards, Mikael -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@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.