[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.
In your
schema.yml
comment theSortable
behavior to all of your models and place an equivalentposition
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 }
Run
symfony doctrine:build --all --and-load --no-confirmation
. This will correctly insert all the data in the database.Restore your
schema.yml
and runsymfony doctrine:build --all-classes --model --forms --filters
. This will restore theSortable
behavior in your models without affecting your data.
精彩评论