[TYPO3-mvc] Making JSON data from object

Roland most.wanted at gmx.at
Fri Nov 16 11:41:56 CET 2012


hi claus,

 > one thing i noticed: reflexive associations in domain model objects
 > result to this:
 >
 > {
 >      "uid": 1,
 >      "name": "Product 001",
 >      "categories": [
 >          {
 >              "uid": 4
 >          },
 >          {
 >              "uid": 7
 >          }
 >      ],
 >      "accessories": [
 >          {
 >              "uid": 8,
 >              "name": "Product 008",
 >              "zubehoer": []
 >          },
 >          {
 >              "uid": 12,
 >              "name": "Product 012",
 >              "zubehoer": []
 >          }
 >      ]
 > }
 >
 > this represents one "Product". "Categories" are represented only by
 > their uid but "Accessories" are represented by all their attributes.
 > "Accessories" are also "Products" - so there is a reflexive
 > association from "Product" to "Product".

no, i was wrong: "Categories" are also represented by all their 
attributes - if the @json annotation is also added to the categories' 
attributes!

Sorry for my confusion.

kind regards

roland


More information about the TYPO3-project-typo3v4mvc mailing list