mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
QueryBulder -> join alias parameter not expect 'as' word as alias #6826
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 @Zlyy on GitHub (Sep 14, 2021).
Bug Report
| Version | 2.9.3
Summary
When I tried to use 'as' word as alias (not without reason - entity name was AddonSupplier and according to my company code standards we use first letters of entity name) - I got unclear exception message. Of course I know that using words like this as alias is very bad practice, but I did this without thinking.
Current behavior
$builder ->select('ad') ->from(AddonDesign::class, 'ad')->join('ad.parent', 'as')->join('as.parent', 'a')->where('a = :addon')->setParameter('addon', $this->addon);DQL from exception:
SELECT COUNT(ad.id) FROM App\Addons\Entity\AddonDesign ad INNER JOIN ad.parent as INNER JOIN as.parent a WHERE a = :addonMisleading exception message:
And exception message, which is in my mind misleading:
[Semantical Error] line 0, col 95 near '.parent a WHERE': Error: Identification Variable as used in join path expression but was not defined before.Expected behavior
Aliases should be check or error message should be fixed
Exception with message that I cant use 'as' word as an alias.
@greg0ire commented on GitHub (Sep 15, 2021):
Possible next step: write a test to reproduce this.
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1757Test.phpcould be used as a template since it involves->jointoo.