Jump to:

23452 Posts in 18901 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Database Connectivity

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1065 Views
  • Grumble
    Avatar
    Community Member
    1 Post

    Database Connectivity Link to this post

    Hi. I'm new to CMSs and am choosing one to work with. If you have a good answer to the following question, I'm yours.
    Lets say I have a large product database. I want to either:
    - load the database into SilverStripe, so I can display it, or
    - let SilverStripe read the database, displaying fields on a page, or
    - access the source code of a page, so I can insert my own php commands to access the database.
    Is any of this possible? If so, how?
    Really basic question I would have thought, but I can't find anything about it.

    Cheers,
    Grumble.

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Database Connectivity Link to this post

    If you want to interact with the Database you can use the ORM layer - eg to get all the products you can do DataObject::get('Product') which will return a set of Product elements. If you want to bypass that (and sometimes its faster) you can use SQLQuery - http://doc.silverstripe.com/doku.php?id=sqlquery

  • wundabred
    Avatar
    Community Member
    1 Post

    Re: Database Connectivity Link to this post

    What if I have all of the info I need in the database, but do not know how to CREATE the database? e.g. I am contemplating Silverstripe for my company's CMS and website, and need to create pricing tables for our products. I would like for these tables to be database driven, for ease of updating. Suggestions?

    Many thanks,
    -
    WB

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: Database Connectivity Link to this post

    @wundabred That is pretty trivial with SS. Once you create your custom DataObject representing your products and build the tables will be created. Next step is to load your data ( pause here... many ways to do this).

    The data is easily maintained with the ModelAdmin, which provides full CRUD operations for your tables in a pleasant GUI. It only takes a few lines of code to use it:
    http://doc.silverstripe.com/doku.php?id=modeladmin

    1065 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.