[TYPO3-mvc] DataMapper: relations with custom constraint?

Jochen Rau jochen.rau at typoplanet.de
Tue Jan 26 20:55:50 CET 2010


Hi Lienhart.

Welcome on the list!

On 26.01.10 15:56, Martin Kutschker wrote:
> Lienhart Woitok schrieb:
>>
>> A few hints or pointers about how this could or should be done would be very much appreciated. Maybe there even exists a simple solution I didn't think of yet, who knows?
>
> I you have a price for each customer it doesn't seem to me a good idea to have a prices property
> attached to a product.
>
> The logic to get the price for a customer should be moved to somewhere else. Maybe a "price service"
> or something like that.

I agree with Masi here. A customer as a property of a price seems a 
little bit awkward. I would implement it as a service, too.

$price = $priceService->getPriceFor($customer, $product);

Inside the Tx_Foo_Domain_Service_PriceService there could reside the 
logic resolving the price based on the properties of the customer ("gold 
membership").

You can check in the controller whether the customer is a logged-in 
frontend-user or not.

BTW nice UML diagrams ;-)

Regards
Jochen


More information about the TYPO3-project-typo3v4mvc mailing list