Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDC-1574 - "new" operator #422

Merged
merged 22 commits into from Oct 5, 2012
Merged

DDC-1574 - "new" operator #422

merged 22 commits into from Oct 5, 2012

Conversation

FabioBatSilva
Copy link
Member

http://www.doctrine-project.org/jira/browse/DDC-1574

Hi guys.

This path adds support for "new" operator

Usage :

SELECT
    new CustomerDTO(c.name, e.email, a.city)
FROM
    Customer c
JOIN
    u.email e
JOIN
    u.address a
ORDER BY
    u.name

Any simple class with a constructor could be used
but for the first version just scalar values are allowed.

it's a big patch, so any sugestion are welcome.

Thanks.

@travisbot
Copy link

This pull request passes (merged 4e8f140b into 72ce9a7).

@fprochazka
Copy link
Contributor

That is awesome! Much less awefull mapping!

), $token);
}

$class = new \ReflectionClass($className);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might wanna add?

if (!$class->isInstantiable()) { error }

@fprochazka
Copy link
Contributor

Could you add passing of whole entity?

SELECT
    new CustomerDTO(c, a.city)
FROM
    Customer c
JOIN
    c.address a

$class = $cache[$key]['class'];
$argIndex = $cache[$key]['argIndex'];
$objIndex = $cache[$key]['objIndex'];
$value = $cache[$key]['type']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline the type conversion (do not use 2 lines)

@FabioBatSilva
Copy link
Member Author

Done !!!

Thanks @guilhermeblanco

@travisbot
Copy link

This pull request passes (merged 697c71cb into 72ce9a7).

@guilhermeblanco
Copy link
Member

+1 from me. @beberlei @asm89 ?

I'd later start to invest some time into supporting nested new operators too, but first let's try to get this one out of the door.

@fprochazka
Copy link
Contributor

What about the passing of whole entity? Does it work?

@henrikbjorn
Copy link

I dont get the use cases, could any one post some?

@stof
Copy link
Member

stof commented Aug 20, 2012

It would be great to support

SELECT
    new CustomerDTO(c, e.email, a.city)
FROM
    Customer c
JOIN
    u.email e
JOIN
    u.address a
ORDER BY
    u.name

@travisbot
Copy link

This pull request passes (merged eb81910c into 72ce9a7).

@travisbot
Copy link

This pull request passes (merged 4c875053 into ece6a00).

beberlei added a commit that referenced this pull request Oct 5, 2012
@beberlei beberlei merged commit 13762f2 into doctrine:master Oct 5, 2012
@FabioBatSilva FabioBatSilva deleted the DDC-1574 branch January 18, 2013 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants