[TYPO3-dev] EXTBASE :: Domain model inheritance for entities

Philipp philippwrann at gmx.at
Mon Aug 19 09:31:26 CEST 2013


Basically you simply have to add the types column to the columns array and add the field to your types-list.
That sounds a little bit confusing. So lets assume you have 4 types for your question model. Then you have a type-field-list for each of them. In this list you place the fields, that are shown in the TCE Form. The types field itself (where you can change the type of your question) has to be existent in all types-field-lists. Lets just explain it using some code-snippets:

Registering your table in ext_tables.php
$TCA['tx_lgquizbase_domain_model_question'] = array(
 'ctrl' => array(
 // general settings like title, label, sorting, enablefields, versioning, translationhandling, searchfelds, icons, etc
'type' => 'type' // this is the type-change column
),
'interface' => array(
// appearance settings for T3Backend
),
'columns' => array(
 'type' => array(
// label
'config' => array( 
 'type' => 'select',
'size' => 1,
'items' => array(
array('Text', 'Tx_LgQuizbasetypes_TextInputQuestion'),
array('Multiple Choice','Tx_LgQuizbasetypes_MultipleChoiceQuestion'),
array('Sorting', Tx_LgQuizbasetypes_SortingQuestion')
)
'default' => 'Tx_LgQuizbasetypes_TextInputQuestion'
)
)
),
// other field settings like questionTitle and so on...
),
'types' => array(
'1' => array('showitem' => 'type'),
'Tx_LgQuizbasetypes_TextInputQuestion' => array('showitem' => 'type,title,question'),
'Tx_LgQuizbasetypes_MultipleChoiceQuestion => array('showitem' => 'type,title,qestion,answers'),
'Tx_LgQuizbasetypes_SortingQuestion' => array('showitem' => 'type,title,question,answers')
),
'pallettes' => array(
 // define pallettes for TCE FORM
)
);

Then you should define question as IRRE field in your quiz. Also you should define Answers as IRRE Field in quesion, so you would be able to create a new quit, adjust it, add questions, change the question type, add answers, save the whole bunch of records and done....


just typed this in here, there my be some syntax errors or something missing, but basically it should work this way.



More information about the TYPO3-dev mailing list