I am having trouble passing an associative array along with a redirect/forward, done in the action-file. Using Symfony 1.3.11.
Obviously there is some flaw, however this is my train of thought: Make a db query, parse the results, add them to an associative array (their ID as key) and redirect the user to the page from whence he came, along with the associative array.
$products = array();
foreach ($results as $res) {
$product = $res->getProduct();
$products[$product->getId()] = $product;
}
$this->getRequest()->setParameter("products", $products);
$this->forward("main", "index");
This is the returned error message:
Catchable fatal error: Object of class Product could not be converted to string in /var/www/perfecthomeweb/lib/vendor/symfony-1.3.11/lib/escaper/sfOutputEscaperObjectDecorator.class.php on line 98
Note: My initial preference was to use the
$this->redirect($request->getReferer());
in conjunction with the desired associative array, looking like this:
$this->redirect($request->getReferer() . "?persons=" . $persons);
This obviously did not work, and I am pretty sure my lack of knowledge of POST/GET is partially to blame. However, if this is doable using $request->getReferer(), that would be my clear preference, as it feels fluid and dynamic.