Hi All,
I'm currently using the LookupDispatchAction class to build
an application. I'm having issues when I try to use
setAttribute on the request object of the nextActionPath
class. The reason seems to be data size related. As in if I
reduce the size of the data I use for setAttribute then it
works successfully - however if I increase it the application
simply hangs and hangs.
This is further compounded by the fact that if you go
directly to the nextActionClass without being redirected
there by another action the setAttribute function works
regardless of the size of the data I pass in.
Should I be using something else to pass data from the
action to the forms? Using the $request object doesn't seem
like a nice way of doing it. Appreciate any help any one
can give!
Cheers
Andrew
Logged In: YES
user_id=662357
G'day Andrew,
>Should I be using something else to pass data from the
>action to the forms?
Have you tried the ActionObjects?
php.MVC ActionObjects Usage Guide
Online doc:
http://phpmvc.net/docs/guides/guidesIdx.php?doc=action-objects
Example;
http://www.phpmvc.net/download/rel/action-objects-v1.0.zip
By using the saveFormBean() or saveValueObject() methods, you
save the object (Form or $valueObject) as a reference, not a
copy.
Using the LookupDispatchAction example:
[http://phpmvc.net/download/rel/lookupdispatchaction-class-v1.0.zip]
AccountDetailForm.php
echo $form->getUserName(); // "Joe Blogs"
// Manually save the object (FormBean).
// (may need to do this in situations like a ActionChain)
$this->saveFormBean($request, $form);
#$this->saveValueObject($request, $valueObject);
AccountManagerAction.php
~~~~~~~~~~~~~~~~~~~
class AccountManagerAction extends LookupDispatchAction {
...---
...listAccounts($mapping, $form, &$request, &$response) {
......//You can get the objects back like this:
......// Get the form bean
......//$request->getAttribute(Action::getKey('FORM_BEAN_KEY'));
......// Get the value object
......//$request->getAttribute(Action::getKey('VALUE_OBJECT_KEY'));
......$fb =
$request->getAttribute(Action::getKey('FORM_BEAN_KEY'));
......echo $fb->getUserName();
}}
ActionObjects Quick Start
~~~~~~~~~~~~~~~~~~~~~~~~
http://phpmvc.net/docs/guides/guidesIdx.php?doc=action-objects#QUICKSTART
The tables below show how to use Errors, FormBean, and Value
(business data) objects in FormAction and Action classes.
Saving ActionObjects in ActionForm Classes
ActionErrors $this->saveErrors($request, $actionErrors)
FormBeans $this->saveFormBean($request, $this)
ValueObjects $this->saveValueObject($request, $valueObject)
Saving ActionObjects in Action Classes
ActionErrors $this->saveErrors($request, $actionErrors)
FormBeans $this->saveFormBean($request, $form)
ValueObjects $this->saveValueObject($request, $valueObject)
The next table shows how to use the Errors, FormBean, and
Value objects in our View Resources.
Retrieving ActionObjects in View Resources (Templates)
ActionErrors $errors->getItemString('logon_username_reqd')
FormBeans $form->username
ValueObjects $data->salesNorth
Does that help?
Best
John
Logged In: NO
The issue was related to the amount of memory allocated in the
php.ini file. The error message I was getting was "Allowed
memory size of 8388608 bytes exhausted".
See http://www.experts-
exchange.com/Web/Web_Languages/PHP/Q_21066345.html for
resolving this problem