I am using a ModelAdmin to display data through gridfield. i want to manage a model in the same way, but from an external database.
In my model admin i have the code to call the model(DataObject) i want to manage:
private static $managed_models = array(
'exampleModel'
);
To insert the data into this second database i have the follwing code inside a function:
global $databaseConfig, $databaseConfig2;
DB::connect($databaseConfig2); //connect to second database
//do somee stuff
DB::connect($databaseConfig); //return to default database
Just for test, i've used a dataObject exampleModel and defined some fields.
In this way, the gridfield is showing results from this model in my modelAdmin, so it's working, but how can i show results from my second database in this gridfield. is it possible ?