コード例 #1
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['product_id', 'created_at'], 'required'], [['product_id', 'receipt_id'], 'integer'], [['price'], 'number'], [['created_at', 'updated_at'], 'safe'], [['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'id']], [['receipt_id'], 'exist', 'skipOnError' => true, 'targetClass' => Receipt::className(), 'targetAttribute' => ['receipt_id' => 'id']]];
 }
コード例 #2
0
ファイル: Shop.php プロジェクト: rafalsky/home-finance
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReceipts()
 {
     return $this->hasMany(Receipt::className(), ['shop_id' => 'id']);
 }