I have 2 models. Order & OrderProduct
When an Order to is added, Im trying to manipulate the OrderProduct data in the beforeValidate() of the Order Model but unsuccessfully.
I've tried. (Both in Order model)
function beforeValidate()
{
parent::beforeValidate();
$this->data['OrderProduct']['total'] = 1000;
return true;
}
function beforeValidate()
{
parent::beforeValidate();
CakeRequest::data('OrderProduct.total', 1000);
return true;
}
But the OrderProduct data isnt being modified when viewed from the controller after a failed transaction (!this->saveAll()).
Could any suggest a alternative solution with out manually setting the data in the controller.