title: How to merge multiple objects if for loop in Zend Framework 1.12
body: <p>I need to get all products which belong to main category and its subcategories.
  Controller part:</p>
  
  <pre><code>$categories = new Application_Model_DbTable_Categories();
  
  $this-&gt;view-&gt;children = $categories-&gt;fetchAll($categories-&gt;select()-&gt;where('parent_category = ?', $this-&gt;view-&gt;category-&gt;category_id));
  
  for ($i=0; $i &lt; count($this-&gt;view-&gt;children); $i++) {
    $this-&gt;view-&gt;products = $products-&gt;fetchAll($products-&gt;select()-&gt;where('belongs_to_category = ?', $this-&gt;view-&gt;children[$i]-&gt;category_id));
  }
  </code></pre>
  
  <p>Then I'd like to display all in for loop in view part, which is easy.
  The solution above does not work correctly, because during each iteration the result object is overwritten by new one.</p>
  
  <p>How to concatenate these objects in 1 variable ($this->view->products)?</p>