TimestampBehavior::class, 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'], ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'] ] ] ]; } public function rules() { return [ [ [ 'sorting_id', 'goods_id', 'num', ], 'integer' ], [ [ 'goods_name', 'attr' ], 'string' ], [ [ 'sorting_id', 'goods_id', 'num', 'goods_name', 'attr' ], 'required' ] ]; } public function attributeLabels() { return [ 'sorting_id' => '备货单ID', 'goods_id' => '商品ID', 'num' => '商品数量', 'goods_name' => '商品名称', 'attr' => '规格', ]; } public function getGoods() { return $this->hasOne(Goods::className(),['id'=>'goods_id']); } }