Symfony doktrin i18n davranış, veri-yükleme hatası: Bütünlük kısıtlaması ihlali

0 Cevap php

Ben Tho I18N kategorileri tablo var istiyorum. Ben jobeet example izlemiştir.

Şema ve aşağıda demirbaşlar veri.

./symfony doctrine:build --db --all-classes --and-migrate
./symfony doctrine:data-load data / demirbaşlar / category.yml

Ben bu komutları çalıştırdığınızda hiçbir veri hatası görüntüler ile veritabanı ve kırmızı kutu içine yerleştirilen olur: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-et' for key 'PRIMARY'

("Mysqld - = kutukdosyasi log" ile oturum) veri-yük görev idam Sorguları:

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?

Ne worng kazanılmış ya var bu bir hata mı?

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 / demirbaşlar / category.yml

myCategory:
  category-1:
    gender: female
    position: '1'
    Translation:
      et:
        name: 'Name value'
        seeking_label: 'Label value'
        seeking: 'Value'

0 Cevap