mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Error when create query for entity named Order #6245
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 @frimuchkov on GitHub (Jun 4, 2019).
Originally assigned to: @Ocramius on GitHub.
Bug Report
Current behavior
Get exception:
Fatal error: Uncaught Doctrine\ORM\Query\QueryException: SELECT o FROM Order o in /var/www/ops/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:43 Stack trace: #0 /var/www/ops/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(456): Doctrine\ORM\Query\QueryException::dqlError('SELECT o FROM O...') #1 /var/www/ops/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(314): Doctrine\ORM\Query\Parser->syntaxError('Doctrine\\ORM\\Qu...') #2 /var/www/ops/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(974): Doctrine\ORM\Query\Parser->match(100) #3 /var/www/ops/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(1732): Doctrine\ORM\Query\Parser->AbstractSchemaName() #4 /var/www/ops/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(1584): Doctrine\ORM\Query\Parser->RangeVariableDeclaration() #5 /var/www/ops/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(1319): Doctrine\ORM\Query\Parser->IdentificationVariableDeclaration() #6 /var/www/ops/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(878 in /var/www/ops/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php on line 54How to reproduce
Crete entity with class name Order and execute:
$entityManager->getRepository('Order')->createQueryBuilder('o')->select('o')->getQuery()->getSQL();Expected behavior
Correct sql
@Ocramius commented on GitHub (Jun 4, 2019):
Closing here: see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/limitations-and-known-issues.html#identifier-quoting-and-legacy-databases
@frimuchkov commented on GitHub (Jun 4, 2019):
No, it's a different problem
There is
@Table(name="orders", indexes={@Index(columns={"title", "note"}, flags={"fulltext"})})@frimuchkov commented on GitHub (Jun 4, 2019):
@Ocramius
There is strings in
Lexer.php:$name = 'Doctrine\ORM\Query\Lexer::T_' . strtoupper($value);So, for this valid DQL:
SELECT o FROM Order omethod return incorrect type ofOrder@Ocramius commented on GitHub (Jun 4, 2019):
Ah yep, you will indeed need to namespace your entity
On Tue, Jun 4, 2019, 22:26 Andrey Frimuchkov notifications@github.com
wrote: