In Doctrine you typically access relations by using the format $this- >Comments , as if it were a datamember, and you will get a Doctrine_Collection back. I don't know if getComments() works in doctrine, thats how you would do it Propel though. In Doctrine the get*() syntax is used for getting columns in the same class. The examples in the symfony Doctrine book should help, http://www.symfony-project.org/doctrine/1_2/en/06-Working-With-Data#chapter_06_sub_working_with_relationships .
HTH Casey On Oct 1, 9:42 am, Ashok <[email protected]> wrote: > No, the query works just fine not only in mysql query browser but also > in other part of the application. And there is nothing wrong with > overriding the save as I've done nothing other than: > print_r($this->getComments()). I've confirmed with the Jobeet tutorial on how > to > > override the save method. There is nothing wrong with it. I'm banging > my head against the wall right now. > > Thanks > > On Oct 1, 10:26 am, Dheeraj Kumar Aggarwal <[email protected]> > wrote: > > > > > hi > > > i think, you have done something wrong in overriding the save function. > > > firstly execute a raw query at the database client like mysql whatever your > > database is. > > > your query will look like > > > select * from comment where post_id = ?; > > > if it returns something then you have done something wrong in save method. > > > On Wed, Sep 30, 2009 at 4:52 PM, Ashok <[email protected]> wrote: > > > > Hi, > > > I've two tables Post and Comment (1:N relationship). What I'm trying > > > to get all the comments related to the post I'm saving from within > > > Post class (/lib/model/doctrine/Post.class.php. and Yes I'm overriding > > > save() function). I don't get any results by calling $this->getComments > > > (); > > > > Am I doing something wrong? Is it just doesn't work this way > > > (reason???) > > > > Thanks > > > -- > > Regards, > > Dheeraj --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
