Something that I didn’t think of the other day is that there is an even better solution to what I posted. Override the query method in the AppModel so that whenever your Models call query the useCache parameter is automatically included.
class AppModel extends Model
{
var $useCache = 'true' ;
function query ($sql)
{
return parent::query ($sql, $this->useCache) ;
}
}
The query signature is different to what I typed above. It uses func_get_args to support any number of parameters. I don’t use query that way and have taken the shortcut of expecting a fully formed SQL statement and nothing more.
|
|
Ryan Boucher is a Software Inquisitor and is passionate about it. You can find a whole raft of articles and anecdotes about software testing and other topics he gets excited about. |
| Tags |