You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When getting ORM:class from laravel $app container laravel creates new instance. It leads to hard to find&fix "duplicate key value violation" on entity when updating (because entity manager has different orm).
It's understandable that it shouldn't happen as everyone should use ORMInterface class, but mistakes happens.
Is this a regression?
Dunno
To Reproduce
spl_object_hash($app->get(ORM::class))
spl_object_hash($app->get(ORMInterface::class))
compare
hash mismatch
Expected behaviour
hash matches
Media prove
No response
Your environment
No response
Additional context
Fix:
Add code below to src/Bridge/Laravel/Providers/Registrators/RegisterORM.php:
$this->app->singleton(ORM::class, function ($app) { return $app->get(ORMInterface::class); });
Sorry for not making pull request with this, no time, deep in deadlines.
The text was updated successfully, but these errors were encountered:
Describe the bug
When getting ORM:class from laravel $app container laravel creates new instance. It leads to hard to find&fix "duplicate key value violation" on entity when updating (because entity manager has different orm).
It's understandable that it shouldn't happen as everyone should use ORMInterface class, but mistakes happens.
Is this a regression?
Dunno
To Reproduce
Expected behaviour
hash matches
Media prove
No response
Your environment
No response
Additional context
Fix:
Add code below to src/Bridge/Laravel/Providers/Registrators/RegisterORM.php:
$this->app->singleton(ORM::class, function ($app) { return $app->get(ORMInterface::class); });
Sorry for not making pull request with this, no time, deep in deadlines.
The text was updated successfully, but these errors were encountered: