Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Nov 2006
    Posts
    247
    Thanks
    13
    Thanked 26 Times in 24 Posts

    Pear DB_DataObject questions.

    OK, I'm in the process of learning AJAX from a book called "Ajax in Action" and it's really big on making applications as simple and flexible as humanly possible. It mentions something cool called "Pear DB_DataObject", an Object-Relational Mapping (ORM) tool which supposedly eliminates the need for messy SQL syntaxes by using objects (classes). You can extend it to your classes and it (from what I'm guessing), builds queries based on variables you set in a class. So like:

    PHP Code:
    require_once "db/DB_DataObject.php";
    class 
    Item extends DB_DataObject
    {
        var 
    $id;
        var 
    $name;
        var 
    $description;
        
    /* ...and so on. */

    OK, so my questions are:

    - First, am I right about how this all works? I hope so, because it seems incredibly useful. The book I have doesn't explain it past mentioning it's usefulness (can't blame it, after all it's a book on AJAX, not PHP).

    - It seems to use blank functions like find() as the "search", fetch() as the "mysql_fetch_array()", and clone() (which I have no idea).. Is there something that shows a list of the DB_DataObject functions and how to use them, or someone who knows? I tried looking on the Pear site and the downloaded scripts themselves, but couldn't find anything.

    This and any information people maybe willing to offer about this DB_DataObject tool would be greatly appreciated. Thanks.
    Last edited by Majoracle; 01-20-2008 at 01:25 PM.

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    I've never used that particular class, but ORM in general is really useful with more complicated applications.

    It's maybe also worth pointing out that the author of that book (which is indeed really good) is one of the moderators on this board, in the javascript forums I believe, going under the nick 'Alien51' (the book is mentioned in his signature...), so maybe worth asking him if he has any useful links
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • Users who have thanked GJay for this post:

    Majoracle (01-21-2008)

  • #3
    Regular Coder
    Join Date
    Nov 2006
    Posts
    247
    Thanks
    13
    Thanked 26 Times in 24 Posts
    Oh wow, how often do you get the chance to consult the author of the book when you need help with something in it? Thanks for letting me know one of them actually posts here.

  • #4
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Well I did not write the php sections since I am a .net guy.

    Did you look at the api on the site: http://pear.php.net/package/DB_Query...QueryTool.html

    I will ask the other author if he knows any good resources on it other than the website.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • Users who have thanked A1ien51 for this post:

    Majoracle (01-22-2008)

  • #5
    Regular Coder
    Join Date
    Nov 2006
    Posts
    247
    Thanks
    13
    Thanked 26 Times in 24 Posts
    OK, yeah, I think I found list of them on that page: http://pear.php.net/package/DB_Query...mentindex.html

    I'll look over them (seems like a lot), but in the mean time, just use PHP's built in functions. Thanks Eric.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •