Skip to content

Loading…

DDC-195: Ordering of associations #2621

Closed
doctrinebot opened this Issue · 6 comments

2 participants

@doctrinebot

Jira issue originally created by user romanb:

It should be supported to set a default ordering for associations.

Example:

/****
 * @OneToMany(targetEntity="Thing", mappedBy="other")
 * @OrderBy("foo*bar ASC, other*bar DESC")
 */
private $things;

The value of the orderby mapping declaration should be a simple DQL snippet.

Main classes to adjust for this feature: SqlWalker, StandardEntityPersister and the metadata drivers, of course.

@doctrinebot

Comment created by @beberlei:

is @OrderBy("string") supported by our parser? I know its the JPA 2.0 equivalent, but imho:

@OneToMany(..., orderBy="snippet")

My patch in DDC-293 uses fields instead of columns though.

Also does the SqlWalker need a change? Is it possible to reliably add the order by clauses when there is already an ORDER BY statement in the query?

@doctrinebot

Comment created by @beberlei:

The issue for @OrderBy(sql) is dependent on the DQL EBNF refactoring, its not possible to easily implement this without.

@doctrinebot

Comment created by @beberlei:

The mapping syntax will be changed in a future commit. Otherwise this is all implemented now.

@doctrinebot

Comment created by @beberlei:

This is now completely implemented and the API is finalized.

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.0-BETA1 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.