[TYPO3-mvc] [!!!] FYI: Implemented first version of single table inheritance.

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Wed Apr 21 14:11:42 CEST 2010


Hello Jochen!

That's of course true and maybe working as intended,
but have a look at the following scenario:

Object tree:
Product
   BookProduct
   FurnitureProduct
   TvProduct

When all products are enlistet on a page - let's assume
this is action 'index' - and you create a link to a single
page - let's call the action 'product' - extbase/fluid will
generate a link with '?tx_myext_object[object]=<uid>'.

When now the action 'product' is called with the product object,
it doesn't know which product type (Book, Furniture, Tv) will be
passed as argument, so therefor I just can check for the parent:

public action product(Tx_MyExt_Domain_Model_Product $product){};

If I write it this way...
public action product(Tx_MyExt_Domain_Model_BookProduct $book){};
Extbase will complain if a TvProduct or FurnitureProduct gets passed.

But imho I would like to get an instance of either 
Tx_MyExt_Domain_Model_BookProduct OR 
Tx_MyExt_Domain_Model_FurnitureProduct OR Tx_MyExt_Domain_Model_TvProduct.

Hopefully I've explained the situation clear enough.

Thanks for your ideas,
Thomas

Am 21.04.2010 12:07, schrieb Jochen Rau:
> Hi Thomas.
>
> On 20.04.10 00:06, Thomas "Thasmo" Deinhamer wrote:
>> I had some time to try single table inheritance in my extension,
>> and I came to a situation, where Extbase does load the base class,
>> rather then the subclass/extending class.
>>
>> May this be based on the fact, that Extbase only returns instances
>> of subclasses when using repositories directly?
>>
>> Like, when I pass an object to an action,
>> ?tx_myext_object[object]=8
>> Extbase loads the base class 'Object' instead of the
>> type which was configured for this object in the backend.
>>
>> Is this working as intended or a bug?
>> When I use the SubobjectRepository directly,
>> the repository returns a SubObject, like supposed.
>
> What class Extbase takes for transforming an incoming
> "?tx_myext_object[object]=8" into an object depends upon the type given
> in the php doc of the action. Could you please post the action?
>
> Regards
> Jochen


More information about the TYPO3-project-typo3v4mvc mailing list