/**
  * @return array|false|mixed|null
  */
 private function _getTreeCategoriesArray()
 {
     $id = $this->_idGroup;
     $cache = Zend_Registry::get('cache');
     $cacheName = 'treeCategoriesArray_' . $id;
     $select = $this->_modelCategoriesMapper->getDbTable()->select()->order('sorting ASC');
     if (!($treeCategories = $cache->load($cacheName))) {
         ini_set('max_execution_time', 900);
         $treeCategories = $this->_modelCategoriesMapper->fetchTreeSubCategoriesInArray($id, $select);
         $cache->save($treeCategories, $cacheName, array('api', 'Catalog', 'treeCategoriesArray'));
     }
     return $treeCategories;
 }
 /**
  * @return array
  * @throws Zend_Exception
  */
 public function getArrayGroupProducts()
 {
     //        $cache = Zend_Registry::get('cache');
     //
     //        $cache->remove('fullCatalogProducts');
     //Массив по группам
     $arrayGroupProducts = array();
     $categoryMapper = new Catalog_Model_Mapper_Categories();
     $treeCategories = $categoryMapper->fetchTreeSubCategoriesInArray();
     foreach ($treeCategories as $item) {
         $this->setCategoryWithProducts(array());
         $children = $item['subCategories'];
         $it = new RecursiveArrayIterator($children);
         iterator_apply($it, array('Utils_CsvCatalogGeneratorController', 'fetchCategoriesWithProducts'), array($it));
         $categoryProducts = $this->getCategoryWithProducts();
         if (!empty($categoryProducts)) {
             foreach ($categoryProducts as $key => $categoryProduct) {
                 $products = $this->getProductsCategory($key);
                 $categoryProducts[$key]['products'] = $products;
             }
         }
         $arrayGroupProducts[$item['id']] = $categoryProducts;
     }
     return $arrayGroupProducts;
 }