I have an application doing calculations that uses Yii2 ActiveRecord to read and write to the database in various places. I need to rerun part of the calculation (for testing and integrity check purposes) without touching the database.
Is there a standard way to make ActiveRecord work on a data structure in memory? The data structure would consist of arrays with objects of the data models. I know this is a long shot, but the intention would be to avoid plan B which is having to locate all the places that interact with the database and refactor them so they can operate in dual mode (either memory structure or database).
$customer = new Customer();
$customer->name = 'ABC';
$customer->save();
In the above example, I would need a way to make save() add the new Customer to the memory data structure instead of the database.