Approach 2) is the generally recommended way of solving that problem.
felix
On Oct 8, 2009, at 9:54 AM, Ionut Matei wrote:
> What is the way to validate the record id of an action containing an
> edit form, an forward to error404 if not found? I'm thinking of 2
> ways to do that:
>
> 1. Try to pull the record from db in the action, and, if not found,
> return 'NotFound', and, in the 'NotFound' view, forward to
> actions.error404_*
>
> or:
>
> 2. Create a validator class that takes the id parameter, fetch the
> record and export() it to the action, and make a handleError()
> method like this:
> public function handleError() {
> if ($this->getContainer()->getValidationManager()-
> >isFieldFailed('id')) {
> return 'NotFound';
> }
> return 'Error';
> }
>
> _______________________________________________
> 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://www.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