Skip to content

Loading…

DDC-1574: Support operator 'new' in DQL #2211

Closed
doctrinebot opened this Issue · 6 comments

1 participant

@doctrinebot

Jira issue originally created by user @FabioBatSilva:

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

@doctrinebot

Comment created by @beberlei:

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

@doctrinebot

Comment created by @FabioBatSilva:

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.

@doctrinebot

Comment created by @beberlei:

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.

@doctrinebot

Comment created by @FabioBatSilva:

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

@doctrinebot

Comment created by @FabioBatSilva:

Fixed by : 13762f2

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.4 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.