Note that there are some explanatory texts on larger screens.

plurals
  1. POSymfony doctrine i18n behavior data-load failure: Integrity constraint violation
    primarykey
    data
    text
    <p>I want tho have I18N categories table. I have followed the <a href="http://www.symfony-project.org/jobeet/1_4/Doctrine/en/19#chapter_19_sub_doctrine_objects" rel="nofollow">jobeet example</a>.</p> <p>Schema and fixtures data below. </p> <pre><code>./symfony doctrine:build --db --all-classes --and-migrate ./symfony doctrine:data-load data/fixtures/category.yml </code></pre> <p>When I run these commands no data gets inserted into database and red box with failure displays: <strong><em>SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-et' for key 'PRIMARY'</em></strong> </p> <p>Queries that get executed on data-load task (logged with "mysqld --log=logfile"): </p> <pre><code>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 </code></pre> <p>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).</p> <p><strong>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?</strong></p> <p>What I have gotten worng or is it a bug?</p> <p>schema.yml</p> <pre> 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) } </pre> <p>data/fixtures/category.yml</p> <pre> myCategory: category-1: gender: female position: '1' Translation: et: name: 'Name value' seeking_label: 'Label value' seeking: 'Value' </pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload