public function urls($id = null) {
$this->Movie->id = $id;
$this->set('Movie' , $this->Movie->read(null, $id));
if ($this->request->is('requested')) {
return $this->set('Movie' , $this->Movie->read(null, $id));
}
if (!$this->Movie->exists()){
$this->redirect(array('controller' => 'pages','action' => 'display'));
}
}
this is my view function, but it doesn’t work !, when the page load, do a predictor to
$this->redirect(array('action'=>'index'));
i don’t know what is the problem, but all other public functions in the movie app working good, please help !
PS: i have the same problem with delete function in users app
public function delete($id = null) {
if (!$this->request->is('post')) {
throw new MethodNotAllowedException();
}
$this->User->id = $id;
if (!$this->User->exists()) {
throw new NotFoundException(__('المستخدم مش صالح'));
}
if ($this->User->delete()) {
$this->Session->setFlash(__('تم يا تيت'));
$this->redirect(array('controller' => 'pages','action' => 'display'));
}
$this->Session->setFlash(__('الحمد لله , مترمتش , حاول تاني'));
$this->redirect(array('controller' => 'pages','action' => 'display'));
}
Model is “Movie”, not “movie”.
Look here:
http://book.cakephp.org/2.0/en/getting-started/cakephp-conventions.html