我试图访问我的表类中的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