On 20.07.2009, at 10:35, Felix Gilcher <[email protected]>  
wrote:

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

You don't. Validation is of course not performed either on a cache hit.

- David



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

Reply via email to