How can I set up conditions to call mysql function from cakephp when there is no cakephp (from model) validation
code which call mysql function from controller :
$generateDocNum = $data_source->fetchAll("
select generateDocNum(?, ?, ?, ?, ?) as generateSn
", array(
'MNF',
$codeTelpArea, // city
$this->request->data['Manifest']['date'], // date
$codeBranch, //branch
$codeModa //Moda
));
The code running well, but the problem is that when the validation returns false (ex : notEmpty validation), the function has already been called. I just want to call that function when the validation is finished.
I have tried using
$this->Model->validationErrors
and
$this->Model->invalidFields()
but this isn't working at all.