I have a class with static methods, and I would like to intercept method calls before the methods are called.
So if I call
$model = DataMapper::getById(12345);
then I want some method in DataMapper to be called before this method is called, and then optionally this intercepting method can subsequently call self::getById(12345). Is there a way to do this?
I am implementing Memcache on my server, so that is why I want to intercept method calls. I don't want the static methods to query the database if models are already cached, and I also don't want to have to modify hundreds of different mapper methods, redundantly, to support memcache.
I am running PHP 5.2.6.