orm icon indicating copy to clipboard operation
orm copied to clipboard

[BUG] Registry returns manager for unsupported classes if it has one manager

Open Hermaniandr opened this issue 1 year ago • 0 comments

If there is only one manager, there is no check that it supports entity - it was removed in this PR https://github.com/laravel-doctrine/orm/pull/288/files As a result, if method called with some random class (e.g. \DateTime) - manager will be returned, even though it doesn't support this class.

Package version, Laravel version

laravel-doctrine/orm: 2.1.0 laravel/framework: 11.9.2

Expected behaviour

LaravelDoctrine\ORM\IlluminateRegistry::getManagerForClass returns null for non-Entities if it has one manager.

Actual behaviour

LaravelDoctrine\ORM\IlluminateRegistry::getManagerForClass returns manager for non-entities if it has one manager.

Steps to reproduce the behaviour

Registry::getManagerForClass(\DateTime::class)

Hermaniandr avatar Aug 19 '24 17:08 Hermaniandr