[TYPO3-mvc] FYI: Progress in implementing support for generic domain models

Christopher Hlubek hlubek at networkteam.com
Tue Jul 21 10:25:28 CEST 2009


Hi Jochen,

> Extbase is still in alpha state. I don't recommend to use it in
> productive environments until TYPO3 4.3 is released.

I know ;) It's for a diploma thesis that we take care of.

>> But I think we have an underlying conceptual problem:
>>
>> Generic stuff should not be configured in the TCA!
> 
> I don't think we have a conceptual problem here. The only thing that is
> configured in the $TCA is the target class name of relations
> (foreign_class). The mapping of classes <=> table is configured via
> TypoScript in my currently developed implementation (see below).

When thinking about Extbase in the backend (we need that for better
backend modules!) TypoScript doesn't seem to be the best idea for me.

> 
>> Imagine two different Extbase plugins using a generic table (e.g.
>> fe_users) and each of these plugins has a model for the generic table (I
>> think it's pretty obvious that sharing a common predefined model for
>> generic tables would be stupid). In the TCA you could only configure ONE
>> model for a table.
> 
> Sharing a common predefined model for generic tables is not stupid as
> long as you are able to extend the predefined model

No, not stupid but problematic nevertheless. As a base class it should
work, but for every Extbase plugin the classes have to be configurable
seperately. Otherwise we have to work out multiple inheritance for PHP.

 >> IMHO the table name should be configured for the specific model to solve
>> this problem. I propose (and have implemented) an annotation "table" for
>> the model classes that is only needed for generic models and will be
>> parsed by the data mapper with the reflection service. I know that the
>> table information doesn't belong to the model from a DDD point of view.
>> But I don't see a better solution right now. We could add that to a
>> repository and get the information from the repository, but that means
>> every generic model needs a repository.
> 
> In my current sketch, the mapping must be configured only for those
> tables and fields that are not holding the naming conventions. The TS
> can be as follows

Yes, I think we should favor convention over configuration.

> 
> plugin.tx_extbase {
>     classes {
>        Tx_Extbase_Domain_Model_FrontendUser {
>        mapping {
>           tableName = fe_users
>           columns {
>               lockToDomain.mapOnProperty = lockToDomain
>           }
>        }
>     }
> }

Just again, I think TypoScript is not the best way to configure the
table. I would favor annotations in the model class. But I like the idea
of configurable property mappings. We certainly need something for
transient attributes, too.


Greetings,

Christopher


More information about the TYPO3-project-typo3v4mvc mailing list