public function actionCategories2file() { $roots = Category2gis::findAll(['parent_id' => null]); $file = fopen("category.csv", "w+"); foreach ($roots as $pcat) { foreach ($pcat->category2gis as $ccat) { fputs($file, "{$pcat->name}\t{$ccat->name}\n"); } } echo "done\n"; }
public function actionIndex() { $roots = Category2gis::findAll(['parent_id' => null]); return $this->render('index', ['roots' => $roots]); }