[TYPO3-mvc] Handling domain model class hierarchies: best practice for fetching all objects?

Roland most.wanted at gmx.at
Sun Apr 7 22:51:48 CEST 2013


hi everybody,

my Extbase extension's domain model consists (amongst others) of these classes:

abstract class Product
abstract class MainProduct extends Product
class Accessory extends Product
class GeneralProduct extends MainProduct
class SpecialProduct extends Main Product

i use single table inheritance.

Now i want to fetch all objects of any concrete subclass of the abstract class Product.

Q 1: what is the best practice to fetch all products to be displayed as a list? i filled an array with 3 repository findAll() calls and assigned this array to the view. i am not sure if this is the way to go. would be much cooler to find all products with one product repositroy method call. is this somehow possible?

Q2: is it ok to distinguish between the 3 concrete classes in a list view fluid template via f:if() condition and a Product.record_type field or is there a better way?

kind regards

roland


More information about the TYPO3-project-typo3v4mvc mailing list