[TYPO3-mvc] TCA-2-Domain-Model Script

Thomas Maroschik tmaroschik at dfau.de
Tue Aug 31 04:19:52 CEST 2010


Am 30.12.09 20:54, schrieb Martin Kutschker:
> Though for new projects it would be probably better if the TCA could be generated with the
> annotations found in the models.

+1 for me for this idea.

Currently I have to deal with about 630 Domain Models, that extend each 
other. Changing Domain Models and adopting TCA to it or the other way 
round really sucks. It would be a charm to have the possibility to 
extend TCA like php classes and autogenerate the needed TCA tables. The 
TCA should be rendered and cached at runtime. Continuous regeneration 
upon development sucks. Furthermore creating SQL from TCA isn't that 
hard. I hope we get rid of TCA mess in TYPO3 Phoenix anyways.

Perhaps someone else then me should try this, because I'm already 
working on to much different projects like extbase_webservices, variable 
storage backends and extbase_kickstarter xml group...

Property annotation could look like this:

/**
  * Text description of the taxes in a given language.
  *
  * @var 
Tx_Extbase_Persistence_ObjectStorage<Tx_Traveldb_Domain_Model_TaxDescription>
[ * @noexclude ] // Optional. Just in case you really need this. Should 
be 0 by convention.
[ * @label 
LLL:EXT:traveldb/Resources/Private/Language/locallang_db.xml:tx_traveldb_domain_model_tax.tax_description 
] // Optional. Should take 
"Resources/Private/Language/locallang_db.xml:@tablename. at columnName" as 
convention.  Could build a nice fluid view helper for this, for eg. 
Backend Modules.
  * @tca {  //JSON to keep php syntax out of comments plus native C 
serialization
  * 	"type":"inline",
  * 	"foreign_table":"tx_traveldb_domain_model_tax_description",
  * 	"foreign_selector":"type",
  * 	"MM":"tx_traveldb_domain_model_tax_description_mm",
  * 	"MM_match_fields":{
  * 		"tablenames":"tx_traveldb_domain_model_tax"
  * 	}
  * }
  * @validate Occurence(maximum=5) // We should have anyway such an 
validator
  */
protected $taxDescription;

and should represent this:

'tax_description' => array(
	'exclude' => '1',
	'label' => 
'LLL:EXT:traveldb/Ressources/Private/Language/locallang_db.xml:tx_traveldb_domain_model_tax.tax_description',
	'config' => array(
		'type' => 'inline',
		'foreign_table' => 'tx_traveldb_domain_model_tax_description',
		'foreign_selector' => 'type',
		'MM' => 'tx_traveldb_domain_model_tax_description_mm',
		'MM_match_fields' => array(
			'tablenames' => 'tx_traveldb_domain_model_tax'
		),
		'maxitems' => '5',
	),
),

Best Regards,

Tom
___________________________
Thomas Maroschik
DFAU


More information about the TYPO3-project-typo3v4mvc mailing list