Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-20-2008, 01:19 PM   PM User | #1
Majoracle
Regular Coder

 
Join Date: Nov 2006
Posts: 246
Thanks: 13
Thanked 26 Times in 24 Posts
Majoracle is an unknown quantity at this point
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..
Majoracle is offline   Reply With Quote
Old 01-20-2008, 01:47 PM   PM User | #2
GJay
Senior Coder

 
Join Date: Sep 2005
Posts: 1,791
Thanks: 5
Thanked 36 Times in 35 Posts
GJay is on a distinguished road
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
GJay is offline   Reply With Quote
Users who have thanked GJay for this post:
Majoracle (01-21-2008)
Old 01-21-2008, 12:39 AM   PM User | #3
Majoracle
Regular Coder

 
Join Date: Nov 2006
Posts: 246
Thanks: 13
Thanked 26 Times in 24 Posts
Majoracle is an unknown quantity at this point
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.
Majoracle is offline   Reply With Quote
Old 01-21-2008, 04:49 AM   PM User | #4
A1ien51
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
A1ien51 will become famous soon enough
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]
A1ien51 is offline   Reply With Quote
Users who have thanked A1ien51 for this post:
Majoracle (01-22-2008)
Old 01-22-2008, 08:45 AM   PM User | #5
Majoracle
Regular Coder

 
Join Date: Nov 2006
Posts: 246
Thanks: 13
Thanked 26 Times in 24 Posts
Majoracle is an unknown quantity at this point
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.
Majoracle is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:41 AM.


Advertisement
Log in to turn off these ads.