[TYPO3-mvc] domain modelling for extensibility

Chris Wolff - AERTiCKET AG cwolff at aer.de
Mon Mar 31 15:57:46 CEST 2014


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