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.

Data Model Questions /

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

Lock a DataObject's table against DDL updates


Go to End


3 Posts   2013 Views

Avatar
Judge

Community Member, 79 Posts

12 April 2010 at 12:15am

If I want to point a DataObject at a third-party table (i.e. from another application running in the same space), is there something I can add to the DataObject to prevent SilverStripe from ever trying to change the structure of that table?

-- Jason

Avatar
Ingo

Forum Moderator, 801 Posts

13 April 2010 at 8:39pm

We've written wrappers for DataObjects before, basically overloading __construct() and write(), although there's no real ORM support for custom table names, column mappings etc. You're probably best off writing a "table data gateway" pattern implementation (http://martinfowler.com/eaaCatalog/tableDataGateway.html) which acts similar to the SilverStripe ORM (implementing get(), get_one(), etc). If you extend the object class from ViewableData, you should be able to use a lot of it in a template context already.

Avatar
Judge

Community Member, 79 Posts

13 April 2010 at 8:42pm

Okay - thanks.

-- Jason