i have just created a new project and this models and the fixtures below:
culture:
id: ~
code: { type: CHAR, size: 6, default: 'it', required: true }
text: { type: VARCHAR, size: 50, default: 'italiano',
required: true }
folder_prod: { type: VARCHAR, size: 50, default: 'italian',
required: true }
sediOK:
id: ~
culture_id: { type: integer, required: true,
foreignTable: culture, foreignReference: id }
nations_id: { type: integer, required: true,
foreignTable: nations, foreignReference: id }
paese_indirizzo: { type: varchar(32), required: true }
ufficio: { type: varchar(64), required: true}
indirizzo: { type: longvarchar, required: true }
culture:
italiano: {code: "it", text: "italiano", folder_prod: "italian" }
frencese: {code: "fr", text: "francese", folder_prod: "francoise" }
inglese: {code: "en", text: "inglese", folder_prod: "english" }
sediOK:
sede_roma_1_italiano: { culture_id: 1, nations_id: 105,
paese_indirizzo: Italia, ufficio: "Ufficio 1:", indirizzo:
"XXXXX" }
sede_roma_1_francese: { culture_id: 2, nations_id: 105,
paese_indirizzo: Italia, ufficio: "Rome Office 1:", indirizzo:
"XXXX" }
sede_roma_1_spagnolo: { culture_id: 4, nations_id: 105,
paese_indirizzo: Italia, ufficio: "Oficina 1", indirizzo:
"xxxx" }
When i do propel:build-all-load it says:
The object “1” from class “Culture” is
not defined in your data file.
So it’s not inserting the culture fixtures but i dont know why…If I
remove the sediOK model and fixtures, and then do build-all-load the
culture fixtures are inserted ok.
Any idea?
Javi
The references to
culture_id: 1,culture_id: 2andculture_id: 4are not defined in the above fixtures – you need to set thesediOKfixtures to reference the cultures by their identifiers, not their IDs in the database.So, for you examples, the ‘internal’ fixture IDs are italiano, frencese and inglese. Change your lines
culture_id: 1,culture_id: 2andculture_id: 4toculture_id: italiano,culture_id: frenceseandculture_id: ingleserespectively.Read the book for more details on this syntax.