problem with redirect and parameters

i’m trying to do this:

$this->redirect( array(‘site/index’,‘user’=>$user, ‘toDo’ => new Todo));

the error is: urlencode() expects parameter 1 to be string, object given

the documentation says:

where am I wrong?

"new Todo" Does this create an array?

the rest are GET parameters in name-value pairs.

class Todo


public function __toString() { return '1'; }


Yeah the key/value pairs in the parameter array should be strings-only, as they are passed via the querystring of the url. Obviously, it’s impossible to pass an unserialized object that way (and passing a serialized one is messy). Best to create the new Todo on the redirected page, and omit passing it in the querystring.

ops my fault :P