Hi Michal,

On Jul 19, 2009, at 8:37 PM, Michal Charemza wrote:


On 19 Jul 2009, at 16:17, David Zülke wrote:
I'm thinking about using routing callbacks on an upcoming projects,
together with caching. I see at 
http://www.agavi.org/documentation/tutorial/step4/routing-callbacks.html
that onMatched can modify parameters extract to the route. So I have
a good understanding of this and caching...

- If using such a parameter in the source for a caching group, is the
source taken to be the parameter before or after the modification by
the callback?

After.

So does this mean that  onMatched is always called, no matter of the
cache settings? In onMatched I was hoping to convert a "nice" product
url alias into a product record instance to pass to the action(s).
This would require a database query that I was hoping to avoid with
some caching.

It is possible to both use caching and onMatched in this way, or would
I have to forgo using callbacks/onMatched and query the database
within the action itself?

The standard way would be to handle that in the validation. The validator has to confirm that the given product id is a valid product id so it has to hit that database anyways. It can export the instance into the request data by using the AgaviValidator::export().

However, validation also happens before action execution, so you need a more elaborate trick to avoid your database query.

cheers

felix

--
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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to