-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Entity STI not working in OneHasOne relationship #714
Comments
I don't necessarily need a test case, but the error would be valuable. |
Could you please provide the class/STI hierarchy? |
@martenb 🙏 |
Ok, here is "minimal" code sample. Works properly with v4... /**
* @property-read int $id {primary}
* @property AdminPersonalData $personalData {1:1 AdminPersonalData::$admin, cascade=[persist, remove]}
*/
class Admin extends Entity /**
* @property Admin $admin {1:1 Admin::$personalData, isMain=true}
*/
class AdminPersonalData extends PersonalData /**
* @property-read int $id {primary}
*/
abstract class PersonalData extends Entity class PersonalDataRepository extends Repository
{
public static function getEntityClassNames(): array
{
return [PersonalData::class, AdminPersonalData::class, UserPersonalData::class];
}
public function getEntityClassName(array $data): string
{
return isset($data['admin'])
? AdminPersonalData::class
: UserPersonalData::class;
}
} |
Thanks a lot. |
@martenb Hi, I tried to reproduce this but sadly I'm unable to do so. My test cases include a query from both sides of the the relationship. So to debug, please:
|
@martenb could you please help me with reproduction? thx. |
Sure, I was on vacation..
|
Thx a lot for the report, fixed; you may test it by updating to |
Looks ok, thx |
Thx, released as https://github.com/nextras/orm/releases/tag/v5.0.1. |
Describe the bug
We are using same personal_data table for admins and users. So, we have 1:1 relationship between them. This feature stops working in v5.
To Reproduce
If you need, i can try to create test with failure.
Versions::
The text was updated successfully, but these errors were encountered: