[TYPO3-mvc] domain modelling for extensibility

Christian Kartnig office at hahnepeter.de
Mon Mar 31 16:53:33 CEST 2014


Hi Chris,

so if I understand you right, if I use one broad table for all 12 
models, I can use the built-in extbase functionality for retrieving 
records of all 12 models at once?

I guess, I have to leave out the "extbase type" field for that purpose?
But to distinguish between the different models, I will need some other 
kind of "type"-field, that reads the type of model the record belongs 
to, right?

Is this the right way to go?

Thanks so much for your help!

best regards,
Christian


Am 31.03.14 15:57, schrieb Chris Wolff - AERTiCKET AG:
> Hi Christian,
> here i try to explain the last line in a little bit more detail:
>
> I suggest using 12 Models, as validation rules are attached to the models. And its most likely that your 12 proccesses have different validation rules.
> (you might reuse models if two forms have the same validation rules, therefore you might endup with less than twelve models)
>
> Then I Would use the Typoscript to map the model to a the shared table:
>
> 	config.tx_extbase.persistence.classes.Tx_YourExtension_Domain_Model_Modelname.mapping {
> 		tableName = tx_yourextension_shared_table
> 		columns {
> 			fieldname1.mapOnProperty = PropertyName1
> 			fieldname2.mapOnProperty = PropertyName2
> 		}
> 	}
>
> You might Leave out the coulumns Mapping if your propertyNames matches the field names (except lowercase underscore instead of upperCamecase)
> (use ext_tables.sql, ext_tables.php as always to define your tables)
> The table should of course have a field for every property uses by your models. :)
>
> You get the backend "list" for free at this point.
> But if you write your own frontend list or backend modul with a list view you might find it handy to create a list view model.
> The list view is model is just a model defining all (needed) properties of table.
> This model allows you to see all fields of the table Without validation rules. You Should not use this "list-model" for database updates.
> As there will be no validation.
>
> For a list view of all "form processes you could then easily create an controller using the list-model with findAll() to find all records.
>
> Regards
> chris
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von Christian Kartnig
> Gesendet: Montag, 31. März 2014 15:26
> An: typo3-project-typo3v4mvc at lists.typo3.org
> Betreff: Re: [TYPO3-mvc] domain modelling for extensibility
>
> Hi Chris,
>
> Thanks for your answer!
>
>> My Suggestion:
>> * CONTROLLER: 1 Controller per Form -> extending from the same
>> base-class
>> * TEMPLATES/PARTIALS: a Template for every Controller (as its Extbase Default), using partials as for shared stuff.
>> * 1 Model for Every Form Process Mapped to the Same Table to enable
>> Shared List Views (you might need a List view Model, with all fields
>> visisible)
>
> This sounds great. I just didn't completely grasp the last line.
> So you suggest 12 Models, but one table? Can I then use built in Extbase query functionality to get data records from all 12 models?
> Is a "list view model" only necessary, if I want to display properties not existing in every model?
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>



More information about the TYPO3-project-typo3v4mvc mailing list