Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

External Database


Reply

2 Posts   1469 Views

Avatar
geist

16 March 2010 at 9:25pm Community Member, 7 Posts

Following challenge:

When creating an new Page, the data should be checked by the data of an external Database.

Example:

Silverstripe:

public static $db = array(
'EventDate' => 'Date',
'EventName' => 'Text',
'EventID' => 'Int',
);

$fields->addFieldToTab("Root.Content.Main", new TextField('EventDate','Date:'));
$fields->addFieldToTab("Root.Content.Main", new TextField('EventName','Text:'));

External Database:

'eventDate' => 'Date',
'eventName' => 'Text',
'eventID' => 'Int',

Bevore storing the data in SilverStripe I have to check, if SilverStripe.EventDate corresponds with an entry in external.eventDate and SilverStripe.EventName corresponds with an entry in external.eventName. If not, store the data in the external database and store the external.eventID in SilverStripe.EventID.

Has anyone any idea?

Cheers

geist

Avatar
geist

24 March 2010 at 9:23pm Community Member, 7 Posts

onBeforeWrite... onBeforeDelete...

Hi geist, first look to the documentation, then ask stupid questions...

Cheers