[TYPO3-mvc] Is some sort of single table inheritance or a similar solution available?

Martin Kutschker masi-no at spam-typo3.org
Fri Apr 9 10:46:58 CEST 2010


Jochen Rau schrieb:
> Hi Thomas.
> 
> On 09.04.10 01:26, Thomas "Thasmo" Deinhamer wrote:
>> I'd like to extend my extbase extension with several types
>> of products, which can be selected by a type field in the backend.
>>
>> Extbase then should load the according model class.
>>
>> For example the product types could be books, furniture,
>> CDs, food etc. and I want to use a specific model object
>> in the frontend/controllers etc.
>>
>> Exists there a proposed solution for this or any idea
>> how to implement this? Should this have been discussed
>> at the T3BOARD10?
> 
> We discussed this feature on T3BOARD10.
> 
> http://forge.typo3.org/issues/show/5883
> 
> The implementation is nearly finished but not yet committed to the svn
> repository (only local git). Extbase 1.1.0 took precedence.
> 
> The basic idea is the following: If a table holda data of different
> types it has to have an extra field. By default, extbase assumes this
> field to be named "tx_extbase_type". This can be overwritten by the
> "type" in the ctrl section of the TCA (in case of tt_content this is
> "CType"). By default the value of this field is the class name of the
> target type. In case of "CType" there must be a mapping defined for each
> type, like:
> 
> config.tx_extbase {
>     persistence{
>         classes {
>             Tx_Voila_Domain_Model_Content_Text {
>                 mapping {
>                     tableName = tt_content
>                     recordType = text
>                 }
>             }
>             Tx_Voila_Domain_Model_Content_BulletList {
>                 mapping {
>                     tableName = tt_content
>                     recordType = bullets
>                 }
>             }
>         }
>     }
> }
> 
> A call to $textRepository->findAll() will return only Objects of class
> Tx_Voila_Domain_Model_Content_Text. The problem is now: How to query for
> all content elements? There is no $contentRepository->findAll().

But there is a $contentRepository, right? I'm not sure if it's a good thing that I have (need?) a
repository for each "record type". They all belong together and should therefore be accessed by the
same repository via a $repository->find<Type>() method.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list