In this case you're really giving a default value to the model object, and you might consider putting it in the constructor.
Daniel On Nov 18, 8:36 am, tirengarfio <[email protected]> wrote: > Thanks! > > On Nov 18, 10:55 am, Martin Settle <[email protected]> wrote: > > > In other words, you need to create the Mensaje object first... > > > public function executeNew(sfWebRequest $request) > > { > > $m = new Mensaje(); > > $m->setContent('Hola'); > > $this->form = new MensajeForm($m)); > > > } > > > 2009/11/18 Gábor Fási <[email protected]>: > > > > The first parameter of a doctrine form should be an object instance > > > (in this case: Mensaje) or null. > > > > On Wed, Nov 18, 2009 at 15:30, tirengarfio <[email protected]> wrote: > > >> Hi, > > > >> im trying to give a default value to a form through this: > > > >> public function executeNew(sfWebRequest $request) > > >> { > > >> $this->form = new MensajeForm(array('content' => 'Hola')); > > > >> } > > > >> This is the model: > > > >> Mensaje: > > >> colums: > > >> sf_guard_user_id: integer(4) > > >> receptor_id: integer(4) > > >> tipo: integer(1) > > >> content: { type: string(255) } > > >> relations: > > >> User: > > >> class: sfGuarUser > > >> foreignType: one > > > >> When i execute mensaje/new i get this error: > > > >> -- The "MensajeForm" form only accepts a "Mensaje" object. -- > > > >> Any idea? > > > >> Javi > > > >> -- > > > >> You received this message because you are subscribed to the Google > > >> Groups "symfony users" group. > > >> To post to this group, send email to [email protected]. > > >> For more options, visit this group > > >> athttp://groups.google.com/group/symfony-users?hl=. > > > > -- > > > > You received this message because you are subscribed to the Google Groups > > > "symfony users" group. > > > To post to this group, send email to [email protected]. > > > For more options, visit this group > > > athttp://groups.google.com/group/symfony-users?hl=. -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=.
