-
fixtures directory tree (example)
tests/Fixtures/Data tests/Fixtures/Test
-
all fixtures implements
FixtureGroupInterface
, Data fixtures returndata
, Test fixtures returntest
-
loading fixtures
./bin/console doctrine:fixtures:load
loads all the fixtures./bin/console doctrine:fixtures:load --group=data
loads onlydata
fixtures
To have this working you need to define fixture service for dev environment.
Service file location config/packages/dev/
Service definition service.xml
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<defaults public="false" autoconfigure="true" autowire="true"/>
<prototype namespace="App\Tests\Fixtures\" resource="../../../tests/Fixtures/*">
<tag name="doctrine.fixture.orm" />
</prototype>
</services>
</container>