[TYPO3-mvc] Conceptual Question with RELATION_HAS_ONE

Jeff Segars jsegars at alumni.rice.edu
Wed Jul 1 05:07:01 CEST 2009


Hey guys,
I know things are in a bit of flux with all the persistence work 
underway but I wanted throw out what is probably an obvious question on 
a simple field with RELATION_HAS_ONE.

Inside the extbase test cases, 
Tx_Extbase_Persistence_Mapper_DataMap_testcase contains a TCA definition 
for a blog author that references an author table rather than just being 
an input field as it is in blog_example. Since it's already in the test 
case, seems like a good example for my question :)

> 'author' => array(
> 	'exclude' => 1,
> 	'label'   => 'LLL:EXT:blog_example/Resources/Language/locallang_db.xml:tx_blogexample_domain_model_blog.author',
> 	'config' => array(
> 		'type' => 'select',
> 		'foreign_class' => 'Tx_BlogExample_Domain_Model_Author',
> 		'foreign_table' => 'tx_blogexample_domain_model_author',
> 		'maxitems' => 1,
> 	)
> ),

 From what I can see of the persistence framework (both in trunk and in 
persistence rewrite) it expects that this simple relation also provides 
a foreign_field and foreign_table field so that the relation is saved in 
the child table rather than the parent table.

This of course doesn't match the blog model that would allow the same 
author to be assigned multiple blogs and doesn't work with the backend 
select type that saves a UID directly in the parent table.

It seems like I must be missing something obvious here so if anyone can 
enlighten me, it would be greatly appreciated ... and if the answer is 
"I'm busy...wait for the persistence rewrite to get done and it will all 
work" that's perfectly fine too ;)

Thanks,
Jeff


More information about the TYPO3-project-typo3v4mvc mailing list