public function save(ProductDto $productDto) { $product = $this->findById($productDto->id); if ($product->load(['Product' => ArrayHelper::toArray($productDto)])) { $product->type = ArrayUtil::arrayToInt($productDto->type); $product->save(); return ArrayHelper::toArray($product); } else { return []; } }
public function findAllOnTree(array $sortOrder = ['sort_order' => SORT_DESC, 'id' => SORT_ASC]) { $lists = Category::find()->orderBy($sortOrder)->all(); return ArrayUtil::listToTree(0, ArrayHelper::toArray($lists)); }