[TYPO3-mvc] Making JSON data from object

dennis ahrens dennis.ahrens at googlemail.com
Thu Mar 4 18:36:24 CET 2010


Hi,

have a look at the ViewHelpers in mvc_extjs:

Json/StoreReadResponseViewHelper.php
Json/StoreUpdateResponseViewHelper.php
Json/StoreCreateResponseViewHelper.php

regards
Dennis

2010/3/4 Andreas Lappe <nd at off-pist.de>:
> On  4.03.10, Pascal Geldmacher wrote:
>> $orders = $this->orderRepository->findAll();
>> $results = array();
>> foreach($orders as $order){
>>       $orderArray = array();
>> ...
>
> I do use the following in my view:
>
> public function render() {
>    if($this->objName !== NULL) {
>        $this->data = (array) $this->data;
>        foreach($this->data as $key=>$value) {
>            $newkey =
>                'tx_ndlibrary_ajax['.$this->objName.']['.$key.']';
>            $this->data[$newkey] = $value;
>            unset($this->data[$key]);
>        }
>    }
>    $arr = array("success" => $this->success,
>            "data" => $this->data);
>    return json_encode($arr);
> }
>
> That worked fine for me, though not really better... :)
>
> So long
> Andy
>
>
> --
> ,,Im Zweifelsfall sollte man sich für das Leben entscheiden.´´
>                                                -Terry Pratchett
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>


More information about the TYPO3-project-typo3v4mvc mailing list