Hi Craigh,

On 7 November 2014 01:40, craigh <[email protected]> wrote:

> Is it possible to @OrderBy an associated entity field (not ID)
>
> I see here (http://www.doctrine-project.org/jira/browse/DDC-3322) that it
> is apparently possible by ID, but I would like to order by another field.
>
> consider this
>
> Three entities:
>
> ForumEntity
> TopicEntity
> PostEntity
>
> ForumEntity has topics @OneToMany
> TopicEntity has a last_post @OneToOne
> (TopicEntity also has posts @OneToMany)
>
> In ForumEntity, I would like to @OrderBy the topics collection by the
> last_post#post_time
>
> possible?
>
> This is not really possible, no: you may need to write a custom repository
method like `ForumRepository#findTopicsByLastTopicLastPostTime(Forum
$forum)`.

Greets,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to