[PR #11116] Implement named arguments for NEW DTO syntax #12802

Open
opened 2026-01-22 16:15:13 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/11116

State: closed
Merged: No


I love using DTOs but it can get pretty annoying to understand what's going on when using a ton of arguments, having to keep track of what is what, in what order, etc... Using named arguments should really help a lot with that I think 👍
Small note but I also made it that trailing commas don't crash the lexer which is a nice qol feature to have imo. I can remove it / move it to another PR if needed 👌

Now the following DQL works as expected

SELECT NEW CustomerDTO(
  email: e.email,
  name: u.name,
  city: a.address,
) FROM ...

Closes #9182

**Original Pull Request:** https://github.com/doctrine/orm/pull/11116 **State:** closed **Merged:** No --- I love using DTOs but it can get pretty annoying to understand what's going on when using a ton of arguments, having to keep track of what is what, in what order, etc... Using named arguments should really help a lot with that I think :+1: Small note but I also made it that trailing commas don't crash the lexer which is a nice qol feature to have imo. I can remove it / move it to another PR if needed 👌 Now the following DQL works as expected ```sql SELECT NEW CustomerDTO( email: e.email, name: u.name, city: a.address, ) FROM ... ``` Closes #9182
admin added the pull-request label 2026-01-22 16:15:13 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#12802