You can pass the database instance when creating the model. For example, when creating the model using the MVC factory:But this is deprecated. Another option is to use the setter method on the model instance:This method can technically also be called from within the model's constructor, if you are building the DB instance inside the model itself instead of injecting it.
Code:
$model = $factory->createModel('Items', 'Administrator', ['dbo' => $externalDb]);
Code:
$model = $factory->createModel('Items', 'Administrator');$model->setDatabase($externalDb);
Statistics: Posted by SharkyKZ — Sun Sep 01, 2024 10:56 am