Example #1
0
 public function getProduct()
 {
     /**
      * 第一个参数为要关联的字表模型类名称,
      * 第二个参数指定 通过子表的 customer_id 去关联主表的 id 字段
      */
     return $this->hasOne(Product::className(), ['product_id' => 'product_id']);
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getObject0()
 {
     return $this->hasOne(Product::className(), ['id' => 'object_id']);
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProduct()
 {
     return $this->hasOne(Product::className(), ['product_id' => 'product_id']);
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['category_id' => 'id']);
 }
Example #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['store_id' => 'store_id']);
 }
 public function getProduct()
 {
     if (!isset($this->_product)) {
         $this->_product = Yii::createObject(Product::className());
     }
     return $this->_product;
 }
Example #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['id' => 'product_id'])->viaTable('{{%entp_product}}', ['entrepreneur_user_id' => 'user_id']);
 }
Example #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['id' => 'product_id'])->viaTable('rubric_product', ['rubric_id' => 'id']);
 }
Example #9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getWishProducts()
 {
     return $this->hasMany(Product::className(), ['id' => 'product_id'])->viaTable('wishlist', ['user_id' => 'id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['agreement_id' => 'id']);
 }
 /**
  * @return array
  */
 public function actions()
 {
     return ['update-cat' => ['class' => crudActionUpdate::className(), 'modelClass' => Category::className(), 'view' => 'update-cat', 'onAfterAction' => [$this, 'afterSaveCategory']], 'delete-cat' => ['class' => crudActionDelete::className(), 'modelClass' => Category::className(), 'onAfterAction' => [$this, 'afterDeleteCategory']], 'insert-product' => ['class' => crudActionCreate::className(), 'modelClass' => Product::className(), 'attributes' => ['parents' => (array) Yii::$app->getRequest()->get('cat_id')], 'view' => 'update-product', 'onAfterAction' => [$this, 'afterSaveProduct']], 'update-product' => ['class' => crudActionUpdate::className(), 'modelClass' => Product::className(), 'view' => 'update-product', 'onAfterAction' => [$this, 'afterSaveProduct']], 'delete-product' => ['class' => crudActionDelete::className(), 'modelClass' => Product::className(), 'onAfterAction' => [$this, 'afterDeleteProduct']]];
 }
Example #12
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProduct()
 {
     return $this->hasOne(\common\models\Product::className(), ['id' => 'product_id']);
 }
 public function actions()
 {
     return ['toggle' => ['class' => ToggleAction::className(), 'modelClass' => Product::className()]];
 }
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['organization_id' => 'id']);
 }