7937 Posts in 1537 Topics by 944 members
|Go to End|
22 June 2013 at 6:58am
I am building several custom modules, what I would like to know, is it possible to get certain info from a table which belongs to another module? If so, how?
I have a module (module1) which holds info of a number of companies, now another module (module2) needs certain info from that other module (module1) and use it in the other module (module2). In module1, I wish to use the url of the company. Can I get that url and add it to module2?
22 June 2013 at 7:29pm
All your websites modules get added to the same database as well as all the classes to the manifest, so yes you can call code which depends on other modules or extend them in particular ways.
So in your example, your module 1 may have a DataObject defined for 'Company' your module 2 can get all those companies by doing $companies = Company::get(); in PHP code. SilverStripe handles finding the correct classes, tables etc for you.
|Go to Top|