[Neos] How to read values from a model-object in PHP (Controller)

Christian Müller christian.mueller at typo3.org
Mon Mar 17 13:27:17 CET 2014


Why don't you store the offer objects directly in your basket?

That would make your life much easier...

Cheers,
Christian

Mario Hinterreiter wrote:
> With help from Axel Wüstemann at the mailing list I found this solution:
>
> My case was a bit complex because my basket, which only lives in the
> user-session, just holds references to an offerModel which of course has
> a repository. The session basket is based on TheDefinitiveGuide >
> PartIII > SessionHandling
>
> My solution was the propertyMapper:
> $item['offer'] holds the identity of my offer-object, and so this line
> fetches it:
> $singleOffer = $propertyMapper->convert($item['offer'],
> 'MY\Package\Domain\Model\Offer');
>
> .. and now the getter works perfectly:
> $price = $singleOffer->getPrice();
>
> Thanks for help!!


More information about the Neos mailing list