Hello,
I have a suggestion about the features of DataObjects. What about adding the ability to specify a connection name that a specific DataObject should need to use. There are situations that some tables are managed by Silverstripe but are located somewhere else or at different database name.
_config.php:
$db = new MySQLDatabase(array(
'server' => 'localhost',
'username' => 'myUsername',
'password' => 'myPassword',
'database' => 'myDatabase'
));
DB::setConn($db, 'external');
code/MyDataObject.php
class MyDataObject extends DataObject
{
public static $conn = 'external';
public static $db = array(
'IsActive' => 'Boolean'
);
public function getCMSFields()
{
return new FieldList(
new CheckboxField('IsActive')
);
}
}
Kind regards,
Alexw