Krzysztof Biernacki programista PHP
Temat: [sf1.4]Modul Test - problem z utworzeniem relacji
Mam problem z utworzeniem schematu i poprawnych relacji pomiedzy tabelami dla modulu Testy w swoim projekcie.Z grubsza zalozenia sa takie, ze jeden test moze zawierac nieskonczenie wiele pytan i odpowiedzi.
Moj plik schema.yml przedstawia sie na chwile obecna nastepujaco:
ModTest:
actAs: [Timestampable]
columns:
id: { type: integer(4), primary: true, notnull: true, autoincrement: true }
slug: { type: string(255), unique: true }
title: { type: string(255), notnull: true }
keywords: { type: string(255) }
description: { type: clob(65535) }
text: { type: clob(65535) }
is_archive: { type: enum, values: ['false', 'true'], default: 'false', notnull: true }
is_active: { type: enum, values: ['false', 'true'], default: 'false', notnull: true }
publication_from: { type: timestamp }
publication_to: { type: timestamp }
relations:
module:
class: Module
local: id
foreign: id
foreignAlias: modTest
foreignType: one
indexes:
fk_ModTest_Module1:
fields: [id]
Answer:
actAs: [Timestampable]
columns:
id: { type: integer(4), primary: true, notnull: true, autoincrement: true }
test_id: { type: integer(4), notnull: true }
name: { type: string(255), notnull: true }
hits: { type: integer(4), default: 0 }
ord: { type: integer(4), notnull: true, default: 0 }
is_active: { type: enum, values: ['false', 'true'], default: 'true', notnull: true }
relations:
modTest:
local: test_id
class: ModTest
foreignType: many
foreignAlias: answers
onDelete: CASCADE
indexes:
fk_Answer_ModTest:
fields: [test_id]
Nie wiem w jaki sposob zrobic polaczenie pomiedzy tabela Answer (przechowujaca odpowiedzi na pytania) a tabela Query (w niej docelowo beda sie znajdowac pytania z testu). Ktos mi pomoze?