First of all, I apologise for the title, I didn't found a good one for this problem.
I'm working on a Symfony project which already exists and I need to add something. So I'm reading it and I came to a point where arrays are used and I don't understand how it works.
$this->categories = Doctrine_Query::create()
            ->from('Category c')
            ->leftJoin('c.Sizings s')
            ->where('c.level = 0')
            ->orderBy('c.id ASC, s.gender ASC, s.size ASC')
            ->execute();
        $rCategories = Doctrine_Query::create()
            ->from('Category c');
        $allCategories = $rCategories->execute();
        $cat = array();
        foreach($allCategories as $c) {
              [...]
              $cat[$c->getRootId()]['children'][$c->getId()]['root'] = $c;
              [...]
So I made some test to see how to access values and this :
$cat[$c->getRootId()]['children'][$c->getId()]['root'] = $c;
    foreach($cat as $ca){
      print($ca['root']);
      echo '<br/>';
      foreach($ca['children'] as $child){
        print($child['root']);
      }
    }
die;
displays :
Tennis Racket //This is the main category Thunder //And this is a subcategory
First of all, why isn't it IDs instead of Names?
What does this code means exactly?
$cat[$c->getRootId()]['children'][$c->getId()]['root'] = $c;
At the end there is this :
$this->allCategories = $cat;
I will use $allCategories in a partial in order to display each categories and its subcategories and then include it in my indexSuccess.
But here is the final point, I have to had a new column. The column is already in the DB and I can access its value in the actionclass with
$c->getBrand();
I would like to had it in the array cat and then in $this->allCategories so I can access it in the partial which I use in the indexSuccess and finally set values in the column brand that I had had in the partial.
I'm afraid that I'm not clear enough but in a nutshell : I don't understand this line :
$cat[$c->getRootId()]['children'][$c->getId()]['root'] = $c;
And I would like to had a new parameter in the array $cat and access this new value after giving it to indexsuccess through
$this->allCategories = $cat;
And I want to know how to access the new value.
I hope I'm clear enough, Thank you for taking the time to read this.
 
    