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   1190 Views

Avatar
Judge

12 April 2010 at 12:15am Community Member, 79 Posts

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

13 April 2010 at 8:39pm Forum Moderator, 801 Posts

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

13 April 2010 at 8:42pm Community Member, 79 Posts

Okay - thanks.

-- Jason