hi i would like to create a Review model following the manual creation
of a Module model. The associations are Module hasMany Review and
Review belongsTo Module. Therefore i made a function that is run after
a Module is saved. However this doesnt seem to be working well, i
would appreciate if you point out any errors in this code or method i
am using to achieve my aims thanks
function add() {
if (empty($this->data)) {
$this->render();
} else {
$this->cleanUpFields();
if ($this->Module->save($this->data)) {
$this->createReview($this->Module->getLastInsertId(), $this-
>data['Module']['code']);
$this->Session->setFlash('The Module has been
saved');
$this->redirect('/modules/index');
} else {
$this->Session->setFlash('Please correct errors
below.');
}
}
}
function createReview($id,$code) {
$results_url = $this->webroot . 'uploads/results/' . $code .
'.pdf';
$feedback_url = $this->webroot . 'uploads/feedback/' .$code .
'.pdf';
$this->data['Review']['module_id']=$id;
$this->data['Review']['feedback_url']=$feedback_url;
$this->data['Review']['results_url']=$results_url;
$this->Module->Review->save();
print($results_url);
echo("<br>");
print($feedback_url);
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---