- Does gregosphatos/doctrine-filters-bundle work with Laravel?
- No. It is a Symfony bundle built around Symfony bundle conventions, a DI extension, and a compiler pass, none of which Laravel's service container understands. Laravel's default persistence layer is Eloquent, and Doctrine is only available through community packages like laravel-doctrine/orm. The portable part is limited to the Doctrine SQLFilter classes, which you would need to register manually.
- How do I install gregosphatos/doctrine-filters-bundle?
- You install it with Composer, but it is intended for Symfony projects and likely carries symfony/framework-bundle and Doctrine ORM 2.x constraints. In a modern Laravel app those constraints can make installation fail without --ignore-platform-reqs or a fork. For Laravel, the practical path is to treat the repository as reference source and copy the filter classes rather than install the bundle.
- What filters does this DoctrineFiltersBundle actually provide?
- The bundle provides integration that lets you register and enable Doctrine SQLFilter implementations declaratively through Symfony configuration. It does not necessarily ship ready-made soft-delete or tenant filters; those are SQLFilter subclasses you write or vendor. Inspect the repository for any example filter classes before assuming specific filters are included.
- Can I use Doctrine SQL filters in Laravel with laravel-doctrine?
- Yes. Under laravel-doctrine/orm you can call $em->getConfiguration()->addFilter($name, $className) and $em->getFilters()->enable($name) during a service provider boot method. That is essentially all the bundle automates for Symfony. You can fork or vendor the filter classes and register them directly without the Symfony bundle wrapper.
- Is gregosphatos/doctrine-filters-bundle maintained?
- The package shows zero stars, zero dependents, and a single author, which strongly suggests it is abandoned. It was almost certainly written against older Symfony 2.x or 3.x and Doctrine ORM 2.x. The MIT license means forking is legally clean, but you should not expect upstream fixes or support.
- What are the alternatives to this bundle for soft deletes in Laravel?
- If you use Eloquent, global scopes and the SoftDeletes trait provide first-class per-model query interception with full Laravel support. If you have committed to Doctrine under Laravel, implement Doctrine SQLFilter classes and register them in a service provider, or use laravel-doctrine's filter support. Rejecting this Symfony bundle in favor of native Laravel mechanisms is usually the right call.
- How do I register a Doctrine filter in Laravel without this bundle?
- In a service provider, resolve the EntityManager and call getConfiguration()->addFilter($name, YourFilter::class), then enable it with getFilters()->enable($name) during boot. Your filter class should extend Doctrine\ORM\Query\Filter\SQLFilter and implement addFilterConstraint. That handful of lines replaces the bundle's Symfony DI integration.
- Does this bundle support Doctrine ORM 3?
- Very likely not. The repository predates Doctrine ORM 3 and targets Doctrine ORM 2.x with older Symfony constraints. Doctrine ORM 3 changed filter APIs and metadata handling, so you would need to fork and update the filter classes. Check composer.json for exact PHP, doctrine/orm, and symfony/* constraints before attempting installation.
- How do I test Doctrine SQL filters in a Laravel application?
- Unit test the filter's addFilterConstraint method to verify the generated SQL condition, then run integration tests with a real EntityManager and Unit of Work against a test database. Assert that DQL, native SQL, and lazy-loaded associations all include the filter where expected. This matters because filters must apply consistently across query paths to avoid data leaks.
- Should I use this Symfony bundle in a Laravel project?
- No, the architecture fit is poor because the bundle's value is Symfony container integration that Laravel cannot use. On an Eloquent codebase, use Eloquent global scopes instead of porting a Doctrine bundle. If you already use Doctrine under Laravel, fork the portable SQLFilter classes and register them directly in a service provider.