I guess i managed to solve it using francky's advice. code is as
follows:
function admin_add() {
if (empty($this->data)) {
$this->render();
} else {
$this->cleanUpFields();
$module = $this->data['Module']['code'];
$conditions = array("Module.code"=>"$module");
if ($this->Module->find($conditions)) {
$this->Module->invalidate('unique');
}
else if ($this->Module->save($this->data)) {
$this->admin_createReview($this->Module->getLastInsertId(), $this-
>data['Module']['code'],$this->data['Module']['name'],$this-
>data['Module']['year_delivered']);
$this->Session->setFlash('The Module has been
saved and an
associated review created');
$this->redirect('/admin/modules/index');
} else {
$this->Session->setFlash('Please correct errors
below.');
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---