I'm using the excellent modRest class, and it's working perfectly for custom tables on the core MODX database (largely thanks to Bob's Guides).
So, for example, I can access
modx_custom_table_widgets through a GET request to
/api/Widgets and see a list of Widgets.
But, I now wish to use another database. This already works fine if I run a simple connector that creates a new instance of XPDO (called e.g. 'custom_db'):
$path = $modx->getOption('core_path').'components/';
require $path.'custom_db/config/config.inc.php';
$custom_db = new xPDO($dsn, $database_user, $database_password);
$success = $custom_db->addPackage('custom_db',$path . 'custom_db/model/','custom_db_');
and then call functions like:
$custom_db->getCollection('MoreWidgets')
But now I would like to access this database through the modRest class.
My guess is that the modRest class is entirely fixed to the Modx object and therefore not adaptable to a different XPDO object - but I would really appreciate input from anyone. Is it possible to extend modRest to do this?
[ed. note: jimbob72 last edited this post 8 years, 7 months ago.]