开发者

symfony: csDoctrineActAsSortablePlugin and i18n

[originally posted on Symfony forum but no (proper) answer has been given yet].

Has anyone ever managed to put Sortable behavior using csDoctrineActAsSortablePlugin on any model having i18n fields? Everything is installed fine but when trying to doctrine:data-load a fixtures file for the i18n model, it crashes by a MySQL inte开发者_如何学JAVAgrity constraint violation about duplicate key entry. Is special handling required for i18n models?

My plugin version is 1.5.4.1 installed on symfony 1.4.8.

Apart from this, do you know of any other solutions (plugins) for adding "moveup" "movedown" functionality in the admin generator?


I've built a custom version of the sfDoctrineBuildTask class that curates this problem:

http://forum.symfony-project.org/viewtopic.php?t=37340#p136449


I've found a better workaround that the one originally posted on symfony forum.

  1. In your schema.yml comment the Sortable behavior to all of your models and place an equivalent position column instead of this (this is the actual column that will be created by the plugin in the database for the specified model) with the following properties:

    position: { type: integer, notnull: false }
    
  2. Run symfony doctrine:build --all --and-load --no-confirmation. This will correctly insert all the data in the database.

  3. Restore your schema.yml and run symfony doctrine:build --all-classes --model --forms --filters. This will restore the Sortable behavior in your models without affecting your data.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜