protected function getModel($id = null) { $model = null; if ($id) { $model = Product::findOne(["id" => $id]); } else { $model = new Product(); } return $model; }
public function init() { parent::init(); $this->models = Product::find()->limit($this->limit)->all(); }