开发者

symfony doctrine data-dump and reload wont't work

开发者 https://www.devze.com 2023-01-18 18:21 出处:网络
I have a database built by Doctrine from schema.yml which I want to modify. Thus, first I saved the data using doctrine:data-dump command. Afterwards I wanted to check if it real开发者_JS百科ly can re

I have a database built by Doctrine from schema.yml which I want to modify. Thus, first I saved the data using doctrine:data-dump command. Afterwards I wanted to check if it real开发者_JS百科ly can reload data, so I called the doctrine:build --all --and-load command.

It successfully rebuilt the database, however when loading data from data1.yml file(where I saved beforehand) it gives me the following error:

Couldn't call Doctrine_Core::set(), second argument should be an instance of Doctrine_Collection when setting one-to-many references.

I would really appreciate if you guys could help me fix this problem.


Well, it's not really possible to dump the database with data-dump and load it later with data-load without any additional steps (talking about more complicated schemas). You need to manually modify your fixtures a bit.

The reason is those tools were not made with such scenario in mind.

The right approach with changing schema is to use doctrine migrations.

0

精彩评论

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