Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can also make your classes more explicit:</p> <pre><code> class Category { public $categoryId = 0, $categoryName = '', $iconUri = ''; } class Resp { public $categoryListResp = null; public function __construct() { $this-&gt;categoryListResp = new CategoryListResp(); } } class CategoryListResp { public $category = array(); } $resp = new Resp(); $resp-&gt;categoryListResp-&gt;category[0]-&gt;categoryId = 1; $resp-&gt;categoryListResp-&gt;category[0]-&gt;categoryName = "Spel"; $resp-&gt;categoryListResp-&gt;category[0]-&gt;iconUri = "PictoSpel.png"; // etc. </code></pre> <p>ADDED (based on henq's comment). To fully utilize the class concept you would need to add some methods to the classes. Then you would not use <code>-&gt;</code> for arrays, but call the respective methods. E.g.</p> <pre><code>class Category { public $categoryId = 0, $categoryName = '', $iconUri = ''; public function __construct($id, $name, $icon) { $this-&gt;categoryId = $id; $this-&gt;categoryName = $name; $this-&gt;iconUri = $icon; } } class Resp { public $categoryListResp = null; public function __construct() { $this-&gt;categoryListResp = new CategoryListResp(); } public function addCategory($index, $id, $name, $icon) { $this-&gt;categoryListResp-&gt;addCategory($index, $id, $name, $icon); } } class CategoryListResp { public $category = array(); public function addCategory($index, $id, $name, $icon) { $this-&gt;category[$index] = new Category($id, $name, $icon); } } $resp = new Resp(); $resp-&gt;addCategory(0, 1, "Spel", "PictoSpel.png"); $resp-&gt;addCategory(1, 2, "Transport", "PictoTransport.png"); // etc </code></pre> <p>You can modify this concept according to your needs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload