mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Documented example of composite primary key array with DQL throws error #5062
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @guilliamxavier on GitHub (Mar 24, 2016).
The documentation http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/composite-primary-keys.html#primitive-types-only (tutorial Composite and Foreign Keys as Primary Key, section Primitive Types only) states that, given the following entity class (note: syntax error unrelated to this issue fixed as PR #5736):
then
EntityRepositories:
that works: executes the SQL query
SELECT t0.name AS name1, t0.year AS year2 FROM Car t0 WHERE t0.name = ? AND t0.year = ?with params
['Audi A8', 2010].DQL:
that doesn't work: throws an exception
Doctrine\ORM\Query\QueryException:[Semantical Error] line 0, col 51 near 'id = ?1': Error: Class VehicleCatalogue\Model\Car has no field or association named id
(from
getSingleResult()).Tested with all versions from 2.5 down to 2.0.
Is it really possible to use a composite id array with DQL?