A bit more to report...
I found
http://fabien.potencier.org/article/9/php-serialization-stack-traces-and-exceptions
and I think I can store the validation report if I modify
AgaviValidationReport to implement Serializable and include:
public function serialize() {
return serialize(array($this->argumentResults, $this->result, $this-
>incidents));
}
public function unserialize($serialized) {
list($this->argumentResults, $this->result, $this->incidents) =
unserialize($serialized);
}
(This removed the PDO exception, but I've still not managed to get the
page after redirect to show the errors)
However, I am now wondering how to pass on the data from the submitted
form. The data would have failed validation, and so I think would not
be accessible in the local request data object. I also then try to
access the context's data object directly (like in the source of the
form population filter), but I get an exception:
Access to request data is locked during Action and View execution and
while templates are rendered. Please use the local request data holder
passed to your Action's or View's execute*() method to access request
data.
So now I am stuck on how to get the data from the user that has failed
validation, so I can store it in the user object, so I can show it
again on the next request.
Michal.
On 28 Feb 2009, at 10:52, Michal Charemza wrote:
> I have now found some more information. It looks like the exception
> doesn't happen when I actually call setAttribute. It happens on the
> *next* request when the user object is being initialised. The
> exception is at:
>
> AgaviSessionStorage->startup()
>
> and the exact line of code is
>
> $this->storage->startup();
>
> Michal.
>
>
>
> On 25 Feb 2009, at 21:28, Michal wrote:
>
>> I do have a PDO connection in the base class for the models, but I'm
>> not sure why it's involved in the request data holder or the
>> validation report...?
>>
>> On Wed, Feb 25, 2009 at 8:49 PM, Felix Gilcher
>> <[email protected]> wrote:
>>> Hi Michal,
>>>
>>> somewhere in the data you're storing a reference to a pdo
>>> connection exists.
>>> What kind of Database connection do you use?
>>>
>>> cheers
>>>
>>> felix
>>>
>>> On Feb 25, 2009, at 9:45 PM, Michal Charemza wrote:
>>>
>>>> I also then tried to store the request data in the User object:
>>>>
>>>> $us = $this->context->getUser();
>>>> $us->setAttribute('commentRequestData', $this->getContext()-
>>>>>
>>>>> getRequest());
>>>>
>>>> But the same exception occurs.
>>>>
>>>> (By the way, the reason why I would like to store the Request
>>>> data is
>>>> to use the Post/Redirect/Get pattern when submitting a form)
>>>>
>>>>
>>>> On 22 Feb 2009, at 21:06, Michal Charemza wrote:
>>>>
>>>>> I'm kinda guessing here, but to store the validation report in the
>>>>> User object I tried:
>>>>>
>>>>> $us = $this->context->getUser();
>>>>> $us->setAttribute('commentValidation', $this->getContainer()-
>>>>>>
>>>>>> getValidationManager()->getReport());
>>>>>
>>>>> But an exception is thrown:
>>>>>
>>>>> PDOException
>>>>> You cannot serialize or unserialize PDO instances
>>>>>
>>>>>
>>>>> On 21 Feb 2009, at 15:18, Michal Charemza wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I would like to be able for the FPF to fill forms with values/
>>>>>> errors that have been stored in the User object (and so persists
>>>>>> between requests). I'm not sure
>>>>>>
>>>>>> - What data must be stored in the User object (well, the
>>>>>> submitted
>>>>>> data and any errors, but I'm not sure exactly what the best way
>>>>>> of
>>>>>> doing this)
>>>>>>
>>>>>> - How to then get the FPF to use this data in the view that
>>>>>> requires it.
>>>>>>
>>>>>> Any suggestions?
>>>>>>
>>>>>> Michal.
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> users mailing list
>>>> [email protected]
>>>> http://lists.agavi.org/mailman/listinfo/users
>>>>
>>>
>>> --
>>> Felix Gilcher
>>>
>>> Bitextender GmbH
>>> Paul-Heyse-Str. 6
>>> D-80336 München
>>>
>>> T: +49 89 57 08 15 16
>>> F: +49 89 57 08 15 17
>>> M: +49 172 840 88 28
>>>
>>> [email protected]
>>> http://bitextender.com/
>>>
>>> Amtsgericht München, HRB 174280
>>> Geschäftsführer: David Zülke, Florian Clever
>>>
>>> _______________________________________________
>>> users mailing list
>>> [email protected]
>>> http://lists.agavi.org/mailman/listinfo/users
>>>
>>>
>
_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users