3430 Posts in 1057 Topics by 734 members
|Go to End|
15 December 2013 at 4:51am Last edited: 15 December 2013 4:53am
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.
$db = new MySQLDatabase(array(
'server' => 'localhost',
'username' => 'myUsername',
'password' => 'myPassword',
'database' => 'myDatabase'
class MyDataObject extends DataObject
public static $conn = 'external';
public static $db = array(
'IsActive' => 'Boolean'
public function getCMSFields()
return new FieldList(
24 December 2013 at 1:58am Last edited: 24 December 2013 1:58am
Thanks for willing to contribute to SilverStripe! Propositions won't always be picked up from within these forums though. Please check out this documentation on how to contibute: http://doc.silverstripe.org/framework/en/trunk/misc/contributing/code
In the mean time, as to multiple db connections, there are some solutions/workarounds around. For example: http://www.silverstripe.org/customising-the-cms/show/13692
I remember a discussion about this a short while ago in the core developers group (https://groups.google.com/d/forum/silverstripe-dev) but I can't seem to find it just now...
Basically afaik you cannot work with multiple connections at the same time, but you can switch between connections if need be.
|Go to Top|