-
-
Notifications
You must be signed in to change notification settings - Fork 214
Open
Description
Fixture classes must implement the Doctrine\Common\DataFixtures\FixtureInterface. But this package is a "dev-dependency" that can be skipped for "prod" deployments.
When Symfony is configured to discover the src/ directory, the fixture classes are automatically registered as service in the DIC. But when the doctrine/data-fixtures package is not installed, the files in src/DataFixtures cannot be included by PHP. And the container compilation fails.
A solution is to scan this directory only in when@dev.
services:
_defaults:
autowire: true
autoconfigure: true
App\:
resource: '../src/'
exclude: '../src/DataFixtures/'
when@dev:
services:
App\DataFixtures\:
resource: '../src/DataFixtures/'Using #[WhenNot(env: 'prod')] is not possible since the class cannot be loaded.
greg0ire and Chris53897
Metadata
Metadata
Assignees
Labels
No labels