I was wondering if anyone knew how to generate a fixture.yml from data that is already existing in the database?
As you can use the build-schema to generate a schema, is there a way to do that for data?
symfony propel:build-schema
Fixtures are used to load a "fake" set of data into a database that can then be used for testing or to help give you some interesting data while you're developing your application. This bundle is compatible with any database supported by Doctrine ORM (MySQL, PostgreSQL, SQLite, etc.).
A repository in a term used by many ORMs (Object Relational Mappers), doctrine is just one of these. It means the place where our data can be accessed from, a repository of data. This is to distinguish it from a database as a repository does not care how its data is stored.
A repository is a way to retrieve entities, so put on repositories any method you need to get them, such as getUserByEmail or whatever.
In order to create the data object model that symfony will use, you need to translate whatever relational model your database has to an object data model. The ORM needs a description of the relational model to do the mapping, and this is called a schema.
In symfony 1.4 you just need to write:
./symfony doctrine:data-dump
and you get the file data/fixtures/data.yml
:-)
I found a solution in a mail archive. The user uses
symfony propel:data-dump > fixture.yml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With