Doctrine Project

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Doctrine 2 - ORM
  • Doctrine 2 - ORM
  • DDC-195

Ordering of associations

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0-ALPHA3
  • Fix Version/s: 2.0-BETA1
  • Component/s: Mapping Drivers, ORM
  • Security Level: All
  • Labels:
    None

Description

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.

Issue Links

depends on

Improvement - An improvement or enhancement to an existing feature or task. DDC-335 Refactor DQL EBNF to use JOIN FETCH as syntax for fetch joins only

  • Critical - Crashes, loss of data, severe memory leak.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.
is duplicated by

New Feature - A new feature of the product, which has yet to be developed. DDC-181 Order of many-to-many relationship

  • Major - Major loss of function.
  • Resolved - A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.
relates to

Sub-task - The sub-task of the issue DDC-293 Patch for "orderBy" attribute for @ManyToMany

  • Minor - Minor loss of function, or other problem where easy workaround is present.
  • Resolved - A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.
  • Options
    • Show All
    • Show Open
Progress
Resolved Sub-Tasks

Sub-Tasks

1.
Patch for "orderBy" attribute for @ManyToMany Sub-task Resolved Resolved Benjamin Eberlei
 
2.
Add @OrderBy(sql) to Mapping Drivers Sub-task Resolved Resolved Benjamin Eberlei
 
3.
Add ORDER BY clause to collection persister SQL generation Sub-task Resolved Resolved Benjamin Eberlei
 
4.
Change DQL Parser to comply with ordered collections Sub-task Resolved Resolved Benjamin Eberlei
 

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
  • Source
Hide
Permalink
Benjamin Eberlei added a comment - 31/Jan/10 5:18 PM

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?

Show
Benjamin Eberlei added a comment - 31/Jan/10 5:18 PM 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?
Hide
Permalink
Benjamin Eberlei added a comment - 14/Feb/10 1:09 PM

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

Show
Benjamin Eberlei added a comment - 14/Feb/10 1:09 PM The issue for @OrderBy(sql) is dependent on the DQL EBNF refactoring, its not possible to easily implement this without.
Hide
Permalink
Benjamin Eberlei added a comment - 20/Feb/10 7:09 PM

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

Show
Benjamin Eberlei added a comment - 20/Feb/10 7:09 PM The mapping syntax will be changed in a future commit. Otherwise this is all implemented now.
Hide
Permalink
Benjamin Eberlei added a comment - 26/Feb/10 4:28 PM

This is now completely implemented and the API is finalized.

Show
Benjamin Eberlei added a comment - 26/Feb/10 4:28 PM This is now completely implemented and the API is finalized.

People

  • Assignee:
    Benjamin Eberlei
    Reporter:
    Roman S. Borschel
Vote (1)
Watch (1)

Dates

  • Created:
    06/Dec/09 9:05 PM
    Updated:
    26/Feb/10 4:28 PM
    Resolved:
    26/Feb/10 4:28 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Doctrine Project. Try JIRA - bug tracking software for your team.