[Neos] Re: Computed properties & JSON

Tristan Koch typo3.org at tknetwork.de
Wed Apr 15 10:59:57 CEST 2015

Hi Dmitri!

thank you for pointing my in the right direction. I believe I found an acceptable solution, but feel free to let me know if there is a better approach.

The general idea is to have a central product TS object serving as the model. It is backed by a custom implementation that adds the property asJson to the context (which is a PHP array of properties meant be converted to JSON). This product model (or, to be precise instances of it) is used for both the HTML and JSON product item. One takeaway for me was the fact that properties of a TS object can be accessed from PHP via $this, another that (computed) properties can be added to the context using push/popContext (although this seems a little hacky considering the amount of code required).


More information about the Neos mailing list