It means the "signature" of your save method is different. Make sure
you take the same parameters as the parent function.

Daniel


On Oct 26, 6:19 am, mbernasocchi <mbernasoc...@gmail.com> wrote:
> thanks, it works as expected, I just had to add
> return parent::save($conn); instead of only parent::save($conn); to be
> able to use the object in a template.
>
> the only thing is that i stll get the same warning about the strict
> standard:
> Strict Standards: Declaration of OpenBubbleForm::save() should be
> compatible with that of sfFormDoctrine::save() in /home/marco/
> nosoapnobubbles/trunk/lib/form/doctrine/OpenBubbleForm.class.php on
> line 10
>
> do you know what it means? I suppose my save() method is not complete
> enough... like add transactions or so... any pointer there? thanks
> again
> Marco
>
> On Oct 26, 8:34 pm, Alexandre SALOME <alexandre.sal...@gmail.com>
> wrote:
>
> > The idea :
>
> > class PostForm
> > {
> >   protected $author;
>
> >   public function setAuthor($author)
> >   {
> >     $this->author = $author;
> >   }
>
> >   public function save(Doctrine_Connection $conn = null)
> >   {
> >     if ($this->author !== null)
> >     {
> >       $this->getObject()->setAuthor($this->author);
> >     }
> >     parent::save($conn);
> >   }
>
> > }
>
> > And in your action :
>
> > $this->form->setAuthor($this->getUser()->getGuardUser());
> > $this->form->save();
>
> > 2009/10/26 mbernasocchi <mbernasoc...@gmail.com>
>
> > > thanks a lot,
> > > I see how to handle it now, just putting the save method as you said
> > > gives me the following warning:
> > > Strict Standards: Declaration of OpenBubbleForm::save() should be
> > > compatible with that of sfFormDoctrine::save() in /home/me/
> > > nosoapnobubbles/trunk/lib/form/doctrine/OpenBubbletForm.class.php on
> > > line 10
>
> > > and as well I get Call to undefined method OpenBubbleForm::setAuthor
> > > (), I tried calling it as well setUserId and setuser_id and always get
> > > the same.
>
> > > my model is:
> > > columns:
> > >     user_id:
> > >      type: integer(4)
> > >       notnull: true
> > > relations:
> > >    Author:
> > >       class: sfGuardUser
> > >      local: user_id
> > >      foreign: id
> > >       foreignAlias: OpenBubbles
> > >      onDelete: cascade
> > >      onUpdate: restrict
>
> > > $this in the OpenBubbleForm.class.php is the form not the OpenBubble
> > > (post) no?
>
> > > thanks again Marco
>
> > > On Oct 26, 5:04 pm, Alexandre SALOME <alexandre.sal...@gmail.com>
> > > wrote:
> > > > You must set the user ID after saving.
>
> > > > A possible solution would be to pass a sfGuardUser on saving of form :
>
> > > > class PostForm
> > > > {
> > > >   // ...
> > > >   public function save($author, Doctrine_Connection $conn = null)
> > > >   {
> > > >     $this->setAuthor($author);
> > > >     $this->save($conn);
> > > >   }
>
> > > > }
>
> > > > Another way would be to add a method setAuthor($author) and save method
> > > will
> > > > check if an author was given.
>
> > > > Alexandre
>
> > > > 2009/10/26 mbernasocchi <mbernasoc...@gmail.com>
>
> > > > > Hi, I've a Post model in my app, I need to set the author Id of the
> > > > > post to the id of the logge user (as in any forum). I succeeded by
> > > > > overwriting the save() method of the Post.class.php and making it like
> > > > > this:
>
> > > > >  public function save(Doctrine_Connection $conn = null)
> > > > >  {
> > > > >    if ($this->isNew())
> > > > >    {
> > > > >      $this->setUserId(sfContext::getInstance()->getUser()-
> > > > > >getGuardUser());
> > > > >    }
> > > > >    return parent::save($conn);
> > > > >  }
>
> > > > > but I don't like the thissolution at all because it mixes up
> > > > > application layers and sfContext is not set during doctrine tasks.
>
> > > > > I managed as well to pass the default user from the action to the
> > > > > form, like this:
>
> > > > > public function executeNew(sfWebRequest $request)
> > > > >  {
> > > > >    $open_bubble = new OpenBubble();
> > > > >    $open_bubble->setUserId($this->getUser()->getGuardUser());
> > > > >    $this->form = new OpenBubbleForm($open_bubble);
> > > > >  }
>
> > > > > but then in the form the userId can still be selected, and I unset
> > > > > ($this['user_is']) in the form, then I get a null id.
>
> > > > > any suggestions? this should be really easy no?
>
> > > > > cheers marco
>
> > > > --
> > > > Alexandre Salomé -- alexandre.sal...@gmail.com
>
> > --
> > Alexandre Salomé -- alexandre.sal...@gmail.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
-~----------~----~----~----~------~----~------~--~---

Reply via email to