コード例 #1
0
ファイル: Brand.php プロジェクト: portalsway2/APEDevices
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['id' => 'product_id'])->viaTable('brand_product', ['brand_id' => 'id']);
 }
コード例 #2
0
ファイル: Field.php プロジェクト: portalsway2/APEDevices
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProduct()
 {
     return $this->hasOne(Product::className(), ['id' => 'product_id']);
 }
コード例 #3
0
ファイル: Device.php プロジェクト: portalsway2/APEDevices
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['id' => 'product_id'])->viaTable('device_product', ['device_id' => 'id']);
     //        return $this->hasOne(Product::className(), ['id' => 'device_product_id']);
 }