Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » wrapping external tables in SS DataObjects

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 549 Views
  • sergieboy
    Avatar
    Community Member
    33 Posts

    wrapping external tables in SS DataObjects Link to this post

    I have the mySQL database for SS up and running. All tables OK and tables for DataObject created.
    SS works fine.
    Here's the situation : there is a external loader software which will load every 24Hr several tables from
    a central DATAMART somewhere in the country and pull these tables in the MySQL database,
    which is also the MySQL database for the SS installation. This loading mechanism works fine and several
    external tables are updated in my SS MySQL database.
    The goal is to use these external tables in my SS platform as DataObjects.
    I found nothing in Ingo's book about this. Just until now, I read in some forum that it should be possible
    to work with external tables, but never how.

    How do i "wrap" these external tables into SS DataObjects ?

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: wrapping external tables in SS DataObjects Link to this post

    Hi,

    Firstly to connect to external DB...

    http://www.silverstripe.org/customising-the-cms/show/13692#post293308

    Then to wrap items up into DataObjectSet...

    http://www.silverstripe.org/data-model-questions/show/17245#post304677

    Did you intend to view this data within DOM? The solution I give is to get the data into dataobject sets - mainly, I'd imageine for template parsing, nothing here to then view the data within the DOM (or MOdelAdmin) - that would be much harder.

  • sergieboy
    Avatar
    Community Member
    33 Posts

    Re: wrapping external tables in SS DataObjects Link to this post

    I don't connect to an external DB.
    The tables are succesfully created by the external loader software into the database used by SS.
    The problem is that these databasetables should be a part of my local datamodel in SS.

    There will be relationships between local defined tables and the external tables.

    I have to use the tables as if it were dataobjects, created by SS, and manage it with DOM in the CMS.

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: wrapping external tables in SS DataObjects Link to this post

    In that case I suggest...
    1) create DataObjects for these items (if they don't already exist)
    2) create a script that transforms them from whatever format they are in into the SS structure

  • sergieboy
    Avatar
    Community Member
    33 Posts

    Re: wrapping external tables in SS DataObjects Link to this post

    ...from whatever format they are into the SS structure.
    That I do not understand.
    I'm talking about a normal MySQL database table with a number of colums but which is filled by external loader.

    Instead of creating objects and translating these into database tables, I want to do the reverse operation.
    Just like you can with Java Persistance API (JPA).

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: wrapping external tables in SS DataObjects Link to this post

    from whatever format they are into the SS structure.

    two choices either 1) read then in to DataObjects and write them back to the database or 2) add the meta data silverstripe expects by altering the table and updating it.

    I get what you want, but as far as i know that doesn't exist within the silverstripe ORM.

  • sergieboy
    Avatar
    Community Member
    33 Posts

    Re: wrapping external tables in SS DataObjects Link to this post

    I think only option 2 is possible. The purpose of all this is that changes in the corporate databases, spread all over the country,
    are automatically propagated into the local copies (being the database tables in the SS MySQL databases).
    If I read them into DataObjects and then write them back to the database, the "living link" is broken. If there is a change in the central corporate database table, which will be propagated automatically by the loader, it will not be reflected anymore in the database table which is connected with the object.

    So my last chance is option 2. Being a rookie, is there any docu available somewhere ?

    I thank you sincerely for your replies.

    549 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.