generated from wayofdev/laravel-package-tpl
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
type: bugBug fix (fix)Bug fix (fix)
Description
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
- 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.
Metadata
Metadata
Assignees
Labels
type: bugBug fix (fix)Bug fix (fix)