I'm migrating from 1.3 to 2.1 and got stuck using the CakeRequest::data.
Here's what I do:
in AppController::beforeFilter I'm doing checks in order to do some shifting in $this->request->data if necessary:
// AppController
public function beforeFilter() {
...
$data = $this->request->input('json_decode');
$data = $this->object2array($data); // helper method that transforms an object into an array
if (!empty($data) {
$this->log('Test #1', LOG_DEBUG);
$this->request->data($this->modelClass, $data)
} else {
$this->log('Test #2', LOG_DEBUG);
$this->request->data = $data;
}
$this->mydata = this->data;
}
Now when I call http://mydomain.com/photos/uri, $this->data['Photo'] is available in PhotosController::beforeFilter after parent::beforeFilter was called, as expected.
However, now in PhotosController::uri $this->data['Photo'] all of a sudden is undefined, whereas $this->mydata['Photo'] is not.
Why gets $this->data corrupted?
Thanks Axel
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment