Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      I know that is a very complex feature,
      But would be nice if doctrine DQL get supports for the operator 'new' like hibernate.

      http://docs.jboss.org/hibernate/core/4.0/hem/en-US/html/queryhql.html#queryhql-select

      
      class User
      {
          /**
           * @Id @Column(type="integer")
           * @GeneratedValue
           */
          public $id;
          /**
           * @Column()
           */
          public $name;
          /**
           * @Column()
           */
          public $email;
          // some code
      }
      
      class UserVO
      {
          public function __construct($name, $email)
          {
              /// some code
          }
      }
      
      //DQL : SELECT new UserVO(u.name, u.email) FROM User u;
      

      RELATED :
      DDC-1729

        Activity

        Hide
        Benjamin Eberlei added a comment -

        It might be even rather simple to implement, but I don't see the use-case tbh.

        Show
        Benjamin Eberlei added a comment - It might be even rather simple to implement, but I don't see the use-case tbh.
        Hide
        Fabio B. Silva added a comment -

        Hello Benjamin,

        This is a well-known hibernate feature, this is very usefull when need to use value/transfer objects whit values from many entities or aggregate functions.
        Instead of having a array result from a complex selec with many joins and agragations the result would be used into a simple value object.

        I would like to create this feature if some one could give me some tips about the best way to implement this.

        Show
        Fabio B. Silva added a comment - Hello Benjamin, This is a well-known hibernate feature, this is very usefull when need to use value/transfer objects whit values from many entities or aggregate functions. Instead of having a array result from a complex selec with many joins and agragations the result would be used into a simple value object. I would like to create this feature if some one could give me some tips about the best way to implement this.
        Hide
        Benjamin Eberlei added a comment -

        I think the added complexity should not be done before we have value object support in hydrators.

        The code to touch here is:

        • ResultSetMapping
        • Abstract-/ObjectHydrator

        Please do not attempt this now, i am very unsure about this yet.

        Show
        Benjamin Eberlei added a comment - I think the added complexity should not be done before we have value object support in hydrators. The code to touch here is: ResultSetMapping Abstract-/ObjectHydrator Please do not attempt this now, i am very unsure about this yet.
        Hide
        Fabio B. Silva added a comment -

        I agree with you, we have others important features to do.
        Any way I think that would be a usefull feature.

        I'll be waiting.

        Thanks

        Show
        Fabio B. Silva added a comment - I agree with you, we have others important features to do. Any way I think that would be a usefull feature. I'll be waiting. Thanks
        Show
        Fabio B. Silva added a comment - Fixed by : https://github.com/doctrine/doctrine2/commit/13762f20c9f6daa0c2e4e8a113de01969c6621da

          People

          • Assignee:
            Fabio B. Silva
            Reporter:
            Fabio B. Silva
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: