Projects / DB_DataContainer


DB_DataContainer is a PEAR-compliant database persistence layer and data encapsulation class. It encapsulates the behavior required to make objects persistent, including loading, saving, and deleting objects in a persistent store. It currently supports relational databases and uses PEAR DB for database abstraction.

Operating Systems

Recent releases

  •  21 Dec 2005 15:58

    Release Notes: This release fixes problems with protected and private data members when using PHP5.

    •  17 Dec 2004 16:38

      Release Notes: PHP5 is now supported.

      •  02 Sep 2004 16:33

        Release Notes: The database table can now have extra columns which are ignored by DataContainer. Sibling classes are now overloaded by default, and their constructors were made optional.

        •  10 May 2004 20:06

          Release Notes: The load() method now has more intelligent error handling. Minor internal speed optimizations have been made.

          •  14 Oct 2003 14:52

            Release Notes: A bug with hardcoded queries being silently ignored has been fixed.

            Recent comments

            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.



            class Account extends DB_DataContainer {

            var $name;

            var $number;

            var $desc;



            Installing it only took this :

            sudo pear install

            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.


            Project Spotlight


            A Fluent OpenStack client API for Java.


            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.