/**
  * Выгрузка полной таблицы информ продукта
  *
  * @TODO переделать порционно лимит по памяти (
  */
 public function actionInformProduct()
 {
     $downloadAttr = [];
     $command = Yii::$app->getDb()->createCommand('
     SELECT
         `id`,
         `article`,
         `title`,
         `group`,
         `category`,
         `sub_category`,
         `detail`,
         `brand`,
         `sub_brand`,
         `line`,
         `price`,
         `ma_price`,
         `arrival`
     FROM podruzka_product
     ');
     $attr = new PodruzkaProduct();
     foreach ($attr->attributes() as $att) {
         if ($att != 'l_id' && $att != 'r_id' && $att != 'i_id' && $att != 'ile_id' && $att != 'rive_id' && $att != 'letu_id' && $att != 'updated_at' && $att != 'created_at' && $att != 'deleted_at') {
             $downloadAttr[] = $att;
         }
     }
     $reader = $command->query();
     if (!empty($reader) && !empty($attr)) {
         $filename = sprintf('%s.csv', date_format(new \DateTime(), 'Y-m-d'));
         $now = gmdate("D, d M Y H:i:s");
         header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
         header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
         header("Last-Modified: {$now} GMT");
         // force download
         header("Content-Type: application/force-download");
         header("Content-Type: application/octet-stream");
         header("Content-Type: application/download");
         header('Content-Type: text/csv; charset=windows-1251');
         // disposition / encoding on response body
         header("Content-Disposition: attachment;filename={$filename}");
         header("Content-Transfer-Encoding: binary");
         ob_start();
         $df = fopen("php://output", 'w');
         fputcsv($df, $downloadAttr, ';');
         while ($row = $reader->read()) {
             foreach ($row as $r) {
                 $data[] = iconv('utf-8', 'windows-1251', $r);
             }
             fputcsv($df, $data, ';');
             unset($row);
             unset($data);
         }
         fclose($df);
         echo ob_get_clean();
     }
 }