7939 Posts in 1472 Topics by 944 members
|Go to End|
19 December 2011 at 10:19pm Last edited: 19 December 2011 10:20pm
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 ?
20 December 2011 at 2:30am
Firstly to connect to external DB...
Then to wrap items up into DataObjectSet...
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.
20 December 2011 at 3:01am Last edited: 20 December 2011 3:01am
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.
20 December 2011 at 3:10am
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
20 December 2011 at 5:54am
...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).
20 December 2011 at 6:02am Last edited: 20 December 2011 6:03am
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.
20 December 2011 at 6:50am
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.
|Go to Top|