Apperclass Fixture Bundle allow to import and export fixtures from db to some format (yml at the moment) and viceversa.
php app/console apperclass:fixture:import
php app/console apperclass:fixture:exportThe command line use a Process that with many FixtureManagers transform data into entities and entities into data. If you want to add a FixtureManager to some process you can do it with a tag.
<!-- for import -->
<tag name="apperclass_fixture.import_fixture_manager" />
<!-- for export -->
<tag name="apperclass_fixture.export_fixture_manager" />Every fixture manager during the import process follows these steps:
- Load data with a DataManager
- Decode the data with a parser into a FixturePack
- Transform the fixtures pack into an EntityCollection
- Save the data with an EntityManager
For each step an event is dispatched so you can extend how the data is processed.
apperclass_fixture.data_manager_load
apperclass_fixture.parser_decode
apperclass_fixture.packer_unpack
Every fixture manager during the export process follows these steps:
- Load an EntityCollection from db
- Trasform the EntityCollection into a FixturePack
- Encode the FixturePack into some data
- Save the data (into filesystem)
apperclass_fixture.entity_manager_load
apperclass_fixture.packer_pack
apperclass_fixture.parser_encode
Packers are the core part of the process. The transform entity into FixturePack using several Analyzers. You can inject new analyzers or override existing analyzers to change how packer behaves.
If you want to change how a single property is managed you have to add an analyzer to all Packers you need.
<call method="addAnalyzer">
<argument type="service" id="my_analyzer" />
</call>Every Analyzer has 2 methods fromEntity which set a fixture property analyzing a ReflectionProperty and fromFixture which set an entity property analyzing a Fixture.