This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » symfony 1.3 and 1.4 » Can $object->getRelation() return a doctrine query ?
Can $object->getRelation() return a doctrine query ? [message #91955] Thu, 21 January 2010 14:16 Go to next message
damiend  is currently offline damiend
Messages: 6
Registered: May 2009
Junior Member

First i'm using Symfony 1.3 with Doctrine.

I already worked on several projects with symfony, and i notice something annoying.
When you call $object->getRelation(), it returns all linked objects as a Doctrine_Collection.

But i would often prefer to get a Doctrine_Query, to filter and get only some linked objects. And it seems i can't, i must create a new query for that in model.

Example :
// return all comments via the schema relation
$comments = $post->getComments();

// but what i want only published comments ?
// am i forced to override getComments() and all my 
// "getRelations" methods in model ?

Can't we pass an argument in getter method to say that we'd like a Doctrine_Query instead of a Doctrine_Collection ?

Thank you
Best regards
Re: Can $object->getRelation() return a doctrine query ? [message #102529 is a reply to message #91955 ] Thu, 15 July 2010 14:29 Go to previous message
zewolf  is currently offline zewolf
Messages: 8
Registered: October 2007
Junior Member
Do you have an answer or a solution ?
Previous Topic:How can I check if a file exist or not?
Next Topic:send email from a model class
Goto Forum:

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software