Roave / psr-container-doctrine

Doctrine Factories for PSR-11 Containers
BSD 2-Clause "Simplified" License
95 stars 31 forks source link

Remove obscure `__callStatic` behaviors, prefer natural constructors #122

Closed Slamdunk closed 8 months ago

bcremer commented 8 months ago

Wasn't that a feature so that named entity managers can be easlily registered in a laminas container via configuration like so?

<?php
return [
    'doctrine.SECTION.orm_other' => [EntityManagerFactory::class::class, 'orm_other'],
];

Recent versions of the laminas support closures in the cached config so it can be rewritten as as the following:

<?php
return [
    'doctrine.SECTION.orm_other' => fn() => new EntityManagerFactory('orm_other'),
];
Slamdunk commented 8 months ago

Indeed. Is this a blocker in your opinion?

bcremer commented 8 months ago

Not a blocker, just a general observation. Support for closures in cached configs is supported for a long time now and the "new" syntax should be easy enough for most people.

bcremer commented 8 months ago

But the calls should be changed in the examples in the README https://github.com/Roave/psr-container-doctrine?tab=readme-ov-file#configuration

https://github.com/Roave/psr-container-doctrine/pull/123/files