I am building an application which needs to have full auditing. I have already created a ModelBase, ControllerBase and FormBase which allow me to interact with the database to save audit information when child classes are accessed. The problem I am facing now is with PHQL. If I use something like MyModel::find() then methods that MyModel inherits from ModelBase can be called and used and so I get my audit information. But if I do something like
$query = $this->modelsManager->createQuery("SELECT * from MyModelOne inner join MyModelTwo");
$cars = $query->execute();
Now $cars is a generic query result without any of my auditing functions built in. Is there some way during dependency injection that I can override all default query objects so that those also include code for auditing?