mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Wrong column order in inherited table metadata #5576
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 @mpajunen on GitHub (Jun 15, 2017).
We ran into an issue where the column and parameter order of an insert statement for a new entity don't match. Something like this:
(I might be able to add a failing test case later, but thought I'd report this now in case there's a straightforward way to fix the problem.)
The issue occurs when using Class Table Inheritance and metadata cache. As far as I can tell the problem is that field order of the
ClassMetadataInforeflFieldsproperty is unstable.Without cache:
AbstractClassMetadataFactoryloads the metadata directly if metadata is not found in the cache or if cache is not enabled.AbstractClassMetadataFactorycalls the load implementation for each class in the inheritance hierarchy.ClassMetadataFactoryhandles inherited fields, relations and embeds and adds them toreflFields.ClassMetadataInfo::wakeupReflectionis finally called,reflFieldsalready includes the super class properties.When metadata is found in cache:
ClassMetadataInfo::wakeupReflectionis called immediately andreflFieldsis always empty.reflFields.Insert statement columns always follow the non-cache order. It might be that just handling embeds, fields and relations in the same order everywhere would be enough to fix the problem.