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

Lienhart Woitok Lienhart.Woitok at netlogix.de
Wed Jan 27 10:40:13 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

first of all, thank you all for the input.

> 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").

I just discussed it with a colleague and we came to the conclusion that a service would indeed be an elegant solution to the problem if that service would be called by the getter on first call (lazy loading). I would probably have to tell the DataMapper to not load the objects, but this might be achievable by a LazyLoadingProxy. Somehow the persistence framework should eventually know about the objects so adding or deleting prices for a customer does work.

I need the prices attached to the products as I want to traverse the products with <f:for /> viewhelper and display prices with products. On the other hand Products will sometimes be referenced by BasketItems or the like, so calling the service manually where needed seems tedious (traversing all BasketItems and adding Prices for example).

I'll give it a try these days and report back, Franz is probably interested in the results.

Thanks again for your tipps!


> BTW nice UML diagrams ;-)

Obviously they served their purpose ;-)

Kind regards

Lienhart Woitok
TYPO3 Entwickler

Telefon: +49 (911) 539909 - 0
E-Mail: Lienhart.Woitok at netlogix.de


- --
netlogix GmbH & Co. KG
Systemhaus | Trainingscenter | Medienagentur
Andernacher Straße 53 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: mailto:info at netlogix.de | Internet: http://www.netlogix.de/

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt




-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 2.12.0 (Build 1035)
Charset: Windows-1252

wpUDBQFLYAoBWevMF2ftbKMBCI/JBACbHf4/ngckCA6CugGxHXJbHATuaQwVbcLi
yMgnK3UdmjBBVrn1teIfgmIUAHZyg+mzZQYZTvBAHxI122udyYfz+ElHCWSGWKIT
EthxMBbEcDYYLaBDZ2ct6ZgxA1iRzN0vBS+f8Z4ZH1hy8ydWhdFXow7uorVnpFF3
kZR5ShHFCg==
=zUkg
-----END PGP SIGNATURE-----


More information about the TYPO3-project-typo3v4mvc mailing list