I want tho have I18N categories table. I have followed the jobeet example.
Schema and fixtures data below.
./symfony doctrine:build --db --all-classes --and-migrate
./symfony doctrine:data-load data/fixtures/category.yml
When I run these commands no data gets inserted into database and red box with failure displays: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-et' for key 'PRIMARY'
Queries that get executed on data-load task (logged with "mysqld --log=logfile"):
1 Query DELETE FROM my_category
2 Query START TRANSACTION
3 Query SELECT k.id AS k__id, k.position AS k__position FROM my_category k ORDER BY k.position desc LIMIT 1
4 Query INSERT INTO my_category (gender, position, created_at, updated_at) VALUES ('female', '1', '2011-01-14 12:33:05', '2011-01-14 12:33:05')
5 Query SELECT k.id AS k__id, k.lang AS k__lang, k.slug AS k__slug FROM my_category_translation k WHERE (k.slug LIKE 'name-value%' AND k.lang = 'et' AND k.name = 'Name value')
6 Query INSERT INTO my_category_translation (id, lang, name, seeking_label, seeking, slug) VALUES ('1', 'et', 'Name value', 'Label value', 'Value', 'name-value')
7 Query SELECT k.id AS k__id, k.lang AS k__lang, k.slug AS k__slug FROM my_category_translation k WHERE (k.slug LIKE '%' AND k.lang = 'et_EE' AND k.name IS NULL)
8 Query INSERT INTO my_category_translation (id, lang, slug) VALUES ('1', 'et_EE', '')
9 Query rollback
10 Quit
When I manually run these commands on freshly built database. Queries from 3 to 6 above run fine and insert data. Query nr. 7 does not output data and query nr. 8 is the failing one. (Because id 1 already exists, inserted in step 6).
The problem must be in query nr. 7. "k.lang = 'et_EE'" I'm pretty sure it should be 'et'? Why query nr. 7 is neccessary seems exactly like query nr. 5 but without and/or messed up values?
What I have gotten worng or is it a bug?
schema.yml
myCategory: actAs: Timestampable: ~ Sortable: ~ I18n: fields: [name, seeking_label, seeking] actAs: Sluggable: fields: [name] uniqueBy: [lang, name] builder: [mySluggableTranslit, urlize] columns: name: { type: string(255), notnull: true } gender: { type: string(6) } seeking_label: { type: string(255) } seeking: { type: string(255) }
data/fixtures/category.yml
myCategory: category-1: gender: female position: '1' Translation: et: name: 'Name value' seeking_label: 'Label value' seeking: 'Value'