Details

    • Type: Improvement Improvement
    • Status: 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

          Activity

          Hide
          Benjamin Eberlei added a comment -

          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 - 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
          Benjamin Eberlei added a comment -

          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 - The issue for @OrderBy(sql) is dependent on the DQL EBNF refactoring, its not possible to easily implement this without.
          Hide
          Benjamin Eberlei added a comment -

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

          Show
          Benjamin Eberlei added a comment - The mapping syntax will be changed in a future commit. Otherwise this is all implemented now.
          Hide
          Benjamin Eberlei added a comment -

          This is now completely implemented and the API is finalized.

          Show
          Benjamin Eberlei added a comment - This is now completely implemented and the API is finalized.

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Roman S. Borschel
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: