-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
index-by and order-by do not work for abstract entities with inheritance type "JOINED" in many-to-many relations #6327
Comments
UPD. I found what was causing XDEBUG failure during POST entity initialization, it happens in caused by
Might be additional bug that initializer cant initialize "fetch" relations for child entity with inheritance type "JOINED". Running fixtures load without xdebug works fine, I call "fl" command
Segfaults might be caused by initializer trying to read or write an illegal memory location. It requires to debug php process itself, C language and use additional tools. Might be XDEBUG + PHP bug. |
UPD. after some trials I fixed "SEGMENTATION FAULT" PHP error by linking both models inside Child Tag entity following
|
Additional solution to first issue with index and order by is to use inheritance type table per entity, or dont order and use id for indexing. Decided to go for a second workaround for now, because there are lots of relations on abstract entity to avoid lots of duplications. |
Bug Report
Inheritance type "JOINED" is NOT joined when initializing relations. INDEX-BY and ORDER-BY throws error that column is missing.
Driver - PGSQL 11
PHP 8.1
Summary
index-by
andorder-by
on mappings of inheritance type JOINED is possible only on inverse side or if table permodel, exception primary key of abstract class child eg AbstractTag - SomeTag - id, because joined child table is
missing abstract field eg SomeTag - has no "SLUG" field, column and there is no additional join on parent abstract
table. Missing field is indie parent, abstract class table.
Current behaviour
Error in my project. but should be reproducible:
How to reproduce
Test case scenario from real world:
3 entities, Post, AbstractTag, PostTag.
Relations Post to PostTag bidirectional Many to Many.
Providing mappings (skipped such things as ID and other relations, configs, fields discriminator column etc):
Approximate place which where issue occurs:
vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php::176
I am getting error when running with XDEBUG this place, cant really say at this moment where it fails.
Segmentation fault
Expected behaviour
Extra join performed on parent model if inheritance type JOINED.
So when we INDEX-BY or ORDER-BY tags inside POST entity mapping, Doctrine should add perform extra join on AbstractTag table columns, with tag name. That will result in tags to be ordered / indexed in POST relations to tags.
On inverse side everything seems ok because Post is not Abstract, but if it would, that complicates things. Actually I have this scenario and still testing it, need just to make it work. For now we sort and index by tag id.
Thank you for you time reading it.
The text was updated successfully, but these errors were encountered: