Comments for DB_DataContainer

18 Jan 2005 18:14 pearcec

Excellent for simple object persistence
I was in the middle of trying to write a web based investing application in perl when I was feed up with the complexity of mason. While I think the perl Finance::Quote module is great and fear it will duplicated in PHP, I couldn't bear to deal with mason.

I was using Class::DBI for perl to manage the object persistence in sqlite. It was great. I was trying to find the same type of project in PHP. Of course there is propel. But that thing is huge. And requires multiple projects and XML definitions of the data model. Clearly it would be overkill for my needs.

A good friend of mine turned me onto this project. But not before checking out a bunch of other half-baked projects. I had a little trouble getting started. Anytime I tried to access any of the variables it would segfault. I figured out the overload function in 4.3 was experimental and decided to upgrade to 5. It woulds like a champ. All you need to do is create your class like this.

<?PHP

require_once('DB/DataContainer.php');

class Account extends DB_DataContainer {

var $name;

var $number;

var $desc;

}

?>

Installing it only took this :

sudo pear install http://www.appelsiini.net/~tuupola/php/download/DB_DataContainer-1.3.0.tgz

The only thing it doesn't have compared to Class::DBI in perl is the 1-N relationships. I suppose it would not be to hard to implement.

Screenshot

Project Spotlight

ReciJournal

An open, cross-platform journaling program.

Screenshot

Project Spotlight

Veusz

A scientific plotting package.