[TYPO3-mvc] Conceptual Question with RELATION_HAS_ONE

Jeff Segars jsegars at alumni.rice.edu
Sat Jul 4 00:49:43 CEST 2009


Jochen Rau wrote:
> Hi Jeff.
> 
>>>> 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.
> 
> You are right. This is indeed a misconception inside Extbase. The whole 
> process from $TCA to the Data Map to the Domain Object is on my list. By 
> now I concentrated on the Data Map to Domain Object part.

Thanks for the clarification.  I was mainly concerned that I was missing 
something really obvious :)

>>>> 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 ;)
> 
>> Hopefully, we'll get some word on the *right* way to do this soon.
> 
> Yes. Definitely. I am going extend the Blog Example with an Author Class 
> this evening to test different concepts it in "real life". I will give 
> you feedback asap.

Sound good.  Once the code is in subversion I'll start testing 
immediately.  If I can be of any help before then, just let me know.

Thanks again for all your work here!
Jeff


More information about the TYPO3-project-typo3v4mvc mailing list