DDC-3796: SELECT NEW does not work with composite keys #4653

Closed
opened 2026-01-22 14:46:50 +01:00 by admin · 1 comment
Owner

Originally created by @doctrinebot on GitHub (Jun 26, 2015).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user marcospassos:

I'm getting an error trying to instantiate a DTO using a column that is used as ID and foreign key.

<mapped-superclass name="Campaign">
        <id name="id" column="id" type="campaign_id" />
        <id name="organization" column="organization_id" association-key="true" />
        <field name="name" column="name" type="string" length="255" />
        <many-to-one field="organization" target-entity="Organization">
            <join-column name="organization_id" referenced-column-name="id" on-delete="CASCADE" on-update="CASCADE" />
        </many-to-one>
    </mapped-superclass>
SELECT NEW CampaignDTO(c.id, c.organization, c.name) FROM Campaign c

Result:

[Semantical Error] line 0, col 54 near 'organization,': Error: Invalid PathExpression. Must be a StateFieldPathExpression.
Originally created by @doctrinebot on GitHub (Jun 26, 2015). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user marcospassos: I'm getting an error trying to instantiate a DTO using a column that is used as ID and foreign key. ``` xml <mapped-superclass name="Campaign"> <id name="id" column="id" type="campaign_id" /> <id name="organization" column="organization_id" association-key="true" /> <field name="name" column="name" type="string" length="255" /> <many-to-one field="organization" target-entity="Organization"> <join-column name="organization_id" referenced-column-name="id" on-delete="CASCADE" on-update="CASCADE" /> </many-to-one> </mapped-superclass> ``` ``` sql SELECT NEW CampaignDTO(c.id, c.organization, c.name) FROM Campaign c ``` Result: ``` [Semantical Error] line 0, col 54 near 'organization,': Error: Invalid PathExpression. Must be a StateFieldPathExpression. ```
admin added the Bug label 2026-01-22 14:46:50 +01:00
admin closed this issue 2026-01-22 14:46:50 +01:00
Author
Owner

@beberlei commented on GitHub (Feb 16, 2020):

This was added in 2e90cd9

@beberlei commented on GitHub (Feb 16, 2020): This was added in 2e90cd9
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4653