php-arsenal / doctrine-odm-repository-service-compiler-pass
Autoconfigure Doctrine ODM document repositories in Symfony as services.
Installs: 4 094
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=8.0
- doctrine/annotations: ^1.13
- doctrine/mongodb-odm-bundle: ^4.3
- symfony/dependency-injection: ^5.3
- symfony/finder: ^5.3
README
Autoconfigure Doctrine ODM document repositories in Symfony as services to make them injectable into classes without the need to declare them in services.yaml
.
composer require php-arsenal/doctrine-odm-repository-service-compiler-pass
How to use?
Update your Kernel
class to add this compiler pass.
use PhpArsenal\DoctrineODMRepositoryServiceCompilerPass\DocumentRepositoryAutoconfigureCompilerPass; class Kernel extends BaseKernel { use MicroKernelTrait; ... protected function build(ContainerBuilder $container): void { $container->addCompilerPass(new DocumentRepositoryAutoconfigureCompilerPass()); } ... }
You can also reach defined document classes through parameter doctrine_mongodb.mongodb.odm.document_classes