Entity hydration fails with QuoteStrategy enabled #5009

Open
opened 2026-01-22 14:56:25 +01:00 by admin · 0 comments
Owner

Originally created by @basz on GitHub (Feb 6, 2016).

Originally assigned to: @ostrolucky on GitHub.

I've create a backtick quoting strategy.

Entity hydration seems to fail when I enable the strategy.

$user = $this->getRepository(User::class)->findOneBy(['email' => 'me@example.com']);

Errors with;

Undefined index: id

/Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/Utility/IdentifierFlattener.php:97
/Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:2513
/Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:144
/Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:69
/Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php:147
/Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:720
/Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:196
/Volumes/hf-model-development@s01.localhost/test/src/Entity/Authentication/UserDBTest.php:31

Seems to be the hydrateColumnInfo method in the sqlResult loop of SimpleObjectHydrator::hydrateRowData

When I replace

$this->hydrateColumnInfo($column);

for

$this->hydrateColumnInfo('`'.$column.'`');

Things work as expected.

Originally created by @basz on GitHub (Feb 6, 2016). Originally assigned to: @ostrolucky on GitHub. I've create a backtick quoting strategy. Entity hydration seems to fail when I enable the strategy. ``` $user = $this->getRepository(User::class)->findOneBy(['email' => 'me@example.com']); ``` Errors with; ``` Undefined index: id /Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/Utility/IdentifierFlattener.php:97 /Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:2513 /Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:144 /Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php:69 /Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php:147 /Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:720 /Volumes/hf-model-development@s01.localhost/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:196 /Volumes/hf-model-development@s01.localhost/test/src/Entity/Authentication/UserDBTest.php:31 ``` Seems to be the [hydrateColumnInfo](https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php#L119) method in the sqlResult loop of SimpleObjectHydrator::hydrateRowData When I replace ``` $this->hydrateColumnInfo($column); ``` for ``` $this->hydrateColumnInfo('`'.$column.'`'); ``` Things work as expected.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5009