I found the following code in the controller file:

1       function add() {
2               if (!empty($this->data)) {
3                       $this->Expense->create();
4                       if ($this->Expense->save($this->data)) {
5                               $this->Session->setFlash(__('The Expense has 
been saved', true));
6                               $this->redirect(array('action'=>'index'));
7                       } else {
8                               $this->Session->setFlash(__('The Expense could 
not be saved.
Please, try again.', true));
9                       }

I guess what MIrko Coz means is to do the computation before line 3.
Please correct me if I am wrong. I did not find a save method in  the
controllers hierarchy but I found one in the models hierarchy. So
redefining it in the model will probably give a cleaner code.

thus in the expense.php redefine save as follows.
function save($data = null, $validate = true, $fieldList = array()) {

}
I haven't tried either because I have been sick. Any thoughts.
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to