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.

Data Model Questions /

Lock a DataObject's table against DDL updates


Reply


3 Posts   1232 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