[TYPO3-mvc] resolve single table inheritance objects

Henjo Hoeksma me at henjohoeksma.nl
Wed Apr 13 11:23:16 CEST 2011


On 2011-03-31 12:25:03 +0200, Felix Oertel said:

> hey,
> 
> something i talked about with different people (thanks fkoch for your 
> input) bothers me again and i would like to find a "final" solution.
> 
> using single table inheritance, i've got a class Event (which is not to 
> be used directly) and the inherited classes Workshop and Exhibition. 
> i've got an Event-, Workshop- and Exhibition-repository.
> 
> case 1:
> i want to select a workshop. i do $workshopRepository->findOneBy*() and 
> i'll get back an Workshop-object.
> 
> case 2:
> i want to select a group of events of different types. i do 
> $eventRepository->findBy*() and i'll get back an objectStorage with 
> some Event-objects in it.
> this is not what i want. ;) i'd more like to get back an objectStorage 
> with mixed Workshop- and Exhibition-objects.
> 
> at a first glance my idea would be to resolve the correct object-type 
> trough the sti-configuration. we could go the other way around, read 
> out the type-field from the db, look up which class is supposed to 
> handle this and then build the object of the correct type in the 
> dataMapper.
> 
> what do you think? is there something similar in FLOW3 we have to care 
> about? any ideas?
> 
> regards, foertel

Reading this thread I recognize the thought. I just built an extension 
using STI and it works perfectly. I was under the impression though 
that the general model used, could still call everything (maybe not 
with all the extended properties though).

So if all types have a title property, I would think that querying the 
reposity of the main model would get all types of content.

Do I understand correctly this is not working? I would make sense if it did...

Henjo



More information about the TYPO3-project-typo3v4mvc mailing list