Jeśli tabela główna nie zawiera żadnego pola oprócz ID lub istnieje jakieś, ale nie zostanie uzupełnione treścią, to tabela i18n tej tabeli zostanie wypełniona danymi, ale rekord w głównej tabel nie zostanie utworzony i referencja do głównej tabeli nie zostanie zachowana.
Czy ktoś wie, co należy zrobić, aby można było utworzyć tabelę główną tylko z polem ID ?
Testowy model:
Kod
propel:
posts:
_attributes: { phpName: Post, isI18N: true, i18nTable: posts_i18n }
idMethod: native
id: { type: integer, required: true, primaryKey: true, autoIncrement: true }
test:
type: LONGVARCHAR
posts_i18n:
_attributes: { phpName: PostI18n }
id: { type: integer, required: true, primaryKey: true, foreignTable: posts, foreignReference: id }
culture: { isCulture: true, type: varchar, size: 7, required: true, primaryKey: true }
description: { type: LONGVARCHAR }
posts:
_attributes: { phpName: Post, isI18N: true, i18nTable: posts_i18n }
idMethod: native
id: { type: integer, required: true, primaryKey: true, autoIncrement: true }
test:
type: LONGVARCHAR
posts_i18n:
_attributes: { phpName: PostI18n }
id: { type: integer, required: true, primaryKey: true, foreignTable: posts, foreignReference: id }
culture: { isCulture: true, type: varchar, size: 7, required: true, primaryKey: true }
description: { type: LONGVARCHAR }
i kod
<?php $o=new Post(); //$o->setTest('aaa'); // z tym działa // $o->save(); // z tym nie $o->setCulture('pl'); $o->setDescription('czesc'); $o->save(); $o->setCulture('en'); $o->setDescription('hello'); $o->save(); ?>
Pozdrawiam.