Wednesday, April 11, 2012

Loosing manipulations on CakeRequest:::data

Hi,

I'm migrating from 1.3 to 2.1 and got stuck using the CakeRequest::data property.

Here's what I did:
in AppController::beforeFilter I'm running some checks that sometimes have to result in manipulating $that->request->data:

$data = $that->request->data('json_encode');
$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);
    $that->request->data = $data;
}

Now when I call http://mydomain.com/photos/uri, $this->request->data['Photos'] is available in PhotoController::beforeFilter after parent::filter was called.
However in PhotoController itself $this->request->data['Photos'] is undefined or null

Any ideas?
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: