[TYPO3-mvc] Concrete Table Inheritance

Eike Starkmann starkmann at undkonsorten.com
Tue Apr 29 12:53:08 CEST 2014


Hi Christian,

lest say you have a table "publication" and you have the table "news".
And both classes should inherit from a class item. So item would be a
view that unions both tables. The advantage of a view is that if e.g new
publication are created they are immediately available in the table
item. BUT you have to take care that the uids are unique here is an example:

CREATE OR REPLACE VIEW tx_publications_domain_model_item AS SELECT
	((uid * 2) + 1) AS uid,
	uid AS original_uid,
	title AS title,
	teaser AS teaser,
	...
FROM tx_publications_domain_model_publication
UNION SELECT
 	(uid * 2) AS uid,
	uid AS original_uid,
	title AS title,
	teaser AS teaser,
	...
FROM tx_news_domain_model_news WHERE no_publication = '0';

Regards, Eike

P.S.: Please try to also replay to list. (Had to copy your email)


>Hi Eike,
>
>thanks for your answer!
>For your workaround you needed to write native SQL statements, right?
>I thought about doing that with UNION queries. How would you do that
>with a view?

>best regards,
>Christian
>On 28.04.2014 15:48, Eike Starkmann wrote:
> Hi Christian,
> 
> concrete table inheritance is not possible in extbase out of the box, as
> far as i know.
> 
> I once had the same problem and did a workaround via a sql view:
> 
> Every table has its own class, and supertables are view(joins) of other
> subtables.
> 
> Works nice and you can use class inheritance.
> 
> Regards, Eike
> 
> On 28.04.2014 14:56, Christian Kartnig wrote:
>> Hi there,
>>
>> I just wanted to ask if Concrete Table Inheritance exists in Extbase
>> (yet)? The extbase book says yes, but I didn't find any information on
>> how to set it up. Everywhere there is only Single Table Inheritance
>> described.
>>
>> I just want every subclass to have its own table. I tried to add
>> "extends" statements in the php model classes of the subclasses, but
>> that obviously isn't enough.
>>
>> Can somebody please throw a light on this mystery?
>>
>> Thanks a lot,
>> Christian
> 



More information about the TYPO3-project-typo3v4mvc mailing list