Skip to content

apperclass/fixture-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apperclass Fixture Bundle

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:export

Process

The 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" />

The import process

Every fixture manager during the import process follows these steps:

  1. Load data with a DataManager
  2. Decode the data with a parser into a FixturePack
  3. Transform the fixtures pack into an EntityCollection
  4. 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

The export process

Every fixture manager during the export process follows these steps:

  1. Load an EntityCollection from db
  2. Trasform the EntityCollection into a FixturePack
  3. Encode the FixturePack into some data
  4. Save the data (into filesystem)
apperclass_fixture.entity_manager_load
apperclass_fixture.packer_pack
apperclass_fixture.parser_encode

Packers

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.

The Analyzers

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.

About

Import and export of doctrine fixture

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages