I think he is suggesting something like

public function save()
{
  parent :: save($this);

  // then mabye call
  $this->saveEmbeddedForms($this);
}

On Mar 16, 4:04 pm, maestro <[email protected]> wrote:
> Hi Gareth,
>
> Thanx for the reply!
>
> Am not sure that i understand you correctly. Am overriding the form's
> save() not the propel object's save(). Propel form's original save
> calls the form's object->save() and returns the object.
>
> I'm now trying to do this in another way (in another forum thread) but
> end up with the same problem. It seems like a propel related issue.
>
> On Mar 16, 2:05 pm, Gareth McCumskey <[email protected]> wrote:
>
> > Its because the save function in the base calss retrieves the ID but you are
> > overiding the save mechanism. Try using the parent classes save mechanism in
> > order to let it do that save for you as well as return the ID.
>
> > On Sun, Mar 15, 2009 at 7:42 PM, maestro <[email protected]> wrote:
>
> > > Hello gentlemen,
>
> > > I have a propel form class in which i override the save() function. Am
> > > trying to save the main form object and some related objects. But when
> > > i try to use the id of the just-added main object i find it empty. It
> > > says in the docs. that once a propel object is saved the id should get
> > > set and can be retrieved by getId(). Also I see the main object being
> > > saved in the DB. Why does getId() return null? Is there any other way
> > > to implement this logic?
>
> > > thanks.
>
> > > Here is my code
>
> > >  public function save($con = null)
> > >  {
> > >    try
> > >    {
> > >        $con->beginTransaction();
> > >        $this->object->save();
> > >        $con->commit();
>
> > >        $con->beginTransaction();
>
> > >        foreach($receivers as $reciever){
> > >          $msg_reciever = new MessageReciever();
> > >          if (sfConfig::get('sf_logging_enabled'))
> > >          {
> > >            sfContext::getInstance()->getLogger()->info("****MsgId:
> > > " . $this->object->getId());
> > >          }
> > >          $msg_reciever->setMessageId($this->object->getId());
> > >          ...
> > >          ...
> > >          $msg_reciever->save();
> > >        }
> > >      $con->commit();
> > >    }
> > >    catch (Exception $e)
> > >    {
> > >      $con->rollBack();
> > >      throw $e;
> > >    }
>
>
--~--~---------~--~----~------------~-------~--~----~
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]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to