我試圖訪問我的表類中的beforeSave方法內提交的數據,但我得到的是保存在數據庫中的數據。 public function beforeSave($event,$entity,$options)
{
// submitted data is ABC
// the value DEF is currently in the database
debug($enti
我有2個表Orders和Products。在orders表中有外鍵product_id。有時,訂單不一定包含產品(沒有任何產品ID的訂單是允許的)。在這種情況下,我存在導致問題保存數據的驗證規則。 $rules->add($rules->existsIn(['product_id'], 'Products')); //Validation in the model of Orders.
N.B