I want to pass values from one controller to another. For example I have a Conference controller and I want to create a new Event. I want to pass the Conference id to the event to make sure those two objects are associated. I would like to store in the ivar $conference using beforeFilter method.
Here is my beforeFilter function in the Events controller
public function beforeFilter() {
parent::beforeFilter();
echo '1 ' + $this->request->id;
echo '2 ' + $this->request['id'];
echo $this->request->params['id'];
if(isset( $this->request->params['id'])){
$conference_id = $this->request->params['id'];
}
else{
echo "Id Doesn't Exist";
}
}
Whenever I change url to something like:
http://localhost:8888/cake/events/id/3
or
http://localhost:8888/cake/events/id:3
I am getting an error saying that id is not defined.
How should I proceed?