[TYPO3-mvc] Best practice for a domain model for scaled prices

Michael Knoll mimi at kaktusteam.de
Wed Dec 30 21:09:17 CET 2009


Hi Franz,

> So I was thinking about dropping the "basic price" from 
> tx_myExt_domain_model_price and create it as record with the quantity 1 
> in tx_myExt_domain_model_scaledPriceValues. Does this still sound good 
> to you? 

That sounds much better to me than your first approach. It will be more 
consistent and less error-prone (think about updating prices, which will 
have to be done at 2 places in your first draft!).

Maybe I should rename the scaledPriceValue then to
> tx_myExt_domain_model_priceValue or something, but I fear the resulting 
> queries with joins over several mm-tables will become a performance 
> killer, too.
> 

I actually don't think so. There will be a join of 3 tables:

article->price->scaled_prices

That sounds quite easy for me. Perhaps you could introduce a field 
"standard_price" or "sorting_price" on the "price" object to be able to 
apply any field you wish as a sorting indicator. This could prevent a 
subselect on the scaled price table to get a - what-so-ever-looking - 
price for sorting. I'm not sure, whether this was the "basic_price" in 
your first draft... if that's what you wanted to do with it - I would 
still do so.

Another idea could be to use a price-property on the article. Not for 
returning any prices in the frontend but just for sorting. This could 
prevent you from doing any joins when sorting a list by price.

I hope my thoughts could help you a little!

Greetings

Michael


More information about the TYPO3-project-typo3v4mvc mailing list