Wouldn't it be a lot better if you pass the pc_id to the new form like this
(in the controller):

$eth = new Eth()
$eth->pc_id = sfUser::getAttribute('pc');

$ethForm  = new EthForm($eth);

There should be a loose coupling between classes. This way it's a lot
cleaner.

As for the pc id storing in the session, I wouldn't. I would just after
creating a pc do a redirect to the Eth form with the pc id as a request
parameter (get/post).

Nathan

On Fri, Jan 8, 2010 at 1:02 AM, Mikael <mikael.kermorg...@gmail.com> wrote:

> Hi,
>
> My data model has a Pc table with a 1-n relation with an Eth  table.
>
> I'd like to configure the backend forms in order to :
>
> 1 - Show 'New Pc form' with button 'save and add interface'
> 2 - When pc is saved (processForm), Pcs new id is put in session
> 3 - Then, the form for creating a new interface is shown
>
> At step 3, I want the form for the interface to avoid the selection of
> the Pc, which should be the one just created.
>
> I've tried to do this this way, but does not work :
>
> // lib/form/doctrine/EthForm.class.php
>  class EthForm extends BaseEthForm
> {
>  public function configure()
>  {
>    $this->setDefault('id_obj', sfUser::getAttribute('pc'));
>  }
> }
>
> Could someone help me to do this right ?
>
> 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<symfony-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>
>
>
> --
nat...@nathan.gs : http://nathan.gs : http://twitter.com/nathan_gs
--
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.

Reply via email to