开发者

Doctrine: create fixtures for a certain table

开发者 https://www.devze.com 2023-02-13 04:32 出处:网络
Is it possible to create a fixtures yml file for a certain model from the data already stored in the database (e.g开发者_高级运维. like dump-data CLI but with specifying which data)?When loading fixtu

Is it possible to create a fixtures yml file for a certain model from the data already stored in the database (e.g开发者_高级运维. like dump-data CLI but with specifying which data)?


When loading fixtures, you explicitly declare the models in the fixture file so this is the only way to do it, as far as I know.

If you're referring to loading fixtures into a database with existing data, loading fixtures for a specific model should not affect data in other tables, as long as you don't re-build the models. I haven't tested this though, so please do try it out in a safe environment first.

Another thing to bear in mind is that the data you upload as fixtures need to respect any foreign-key constraints you may have in your database.

0

精彩评论

暂无评论...
验证码 换一张
取 消