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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

External Database


Go to End


2 Posts   2115 Views

Avatar
geist

Community Member, 7 Posts

16 March 2010 at 9:25pm

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

Community Member, 7 Posts

24 March 2010 at 9:23pm

onBeforeWrite... onBeforeDelete...

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

Cheers