2009年4月13日星期一

Re: [fw-mvc] How to exchange data between controllers

Zend_Registry will be emptied after each request, so cannot be an option.

Maybe you should use Zend_Session_Namespace:

// /fetchresults - Store the selected data. Expire after the next
request.
$oDataSessionNamespace = new Zend_Session_Namespace('data');
$oDataSessionNamespace->setExpirationHops(1);
$oDataSessionNamespace->data = $oRowset;

// /graphs - Get previously selected data
if ( !Zend_Session::namespaceIsset('data') )
{
//redirect ?
}

$oDataSessionNamespace = new Zend_Session_Namespace('data');
// Show graph

Giuliano


-cab wrote:
>
> Hello,
>
> this is my situation:
>
> on page /fetchresults the user can run a query and get a nicely-formatted
> set of records. At the bottom of the page i want to add a link "view
> graphs" which should take the user to the page /graphs which will make
> some calculations and graphs with the data previously selected by the
> user. My problem is: what's the best way to pass the recordset i took from
> the database in /fetchresults to the GraphsController?
>
> I was hoping to avoid using Zend_Registry, but if it's the only way...
>
> Thanks!
>

--
View this message in context: http://www.nabble.com/How-to-exchange-data-between-controllers-tp23026937p23030912.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: