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