Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Database querys and OOP

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1180 Views
  • frankibodo
    Avatar
    Community Member
    1 Post

    Database querys and OOP Link to this post

    Hello

    I have trouble getting my head around classes and so on. I want to have a page where I can query the database for a table (installed from outside SS). I have set up a ProductPage.php, ProductHolder.php, but I have no idea how to connect to the databse through SS, and how to actually query?????

    Please help me!!

    As of now I have this error and I have not even tryed to query anything..

    Fatal error: Call to a member function XML_val() on a non-object in /tmp/silverstripe-cache-home-forbrsut-public_html-silverbullet/.cache.home.forbrsut.public_html.silverbullet.tutorial.templates.Layout.ProductHolder.ss on line 84

  • OzziNL
    Avatar
    Community Member
    37 Posts

    Re: Database querys and OOP Link to this post

    No ideas for this one? I do want something similar...

    But I was looking in this forum before trying, so if I find out how...I'll post it.

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Database querys and OOP Link to this post

    In order to create stuff with SS , it's handy to have a basic grasp of Object Oriented design (inheritance and data encapsulation being the most important subjects).

    Basically, you have to create "data-object" classes which map 1-1 on your database-tables (1 class for every table). You don't access the database directly through queries : the data-objects "encapsulate" the interaction with the DB (they take care of that themselves).

    If you want to use an external data-source or a different table , you probably need to peruse the docs Data-Object classes in the docs.

    Good luck !

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