Link to home
Start Free TrialLog in
Avatar of Snyke
Snyke

asked on

MySQL Object storage (Data Persistency)

Hi,

my problem is that I often design my MySQL-Tables the exact same fashion I design my PHP-Classes  (the only difference being that the PHP-Classes also have specific functions while the Database only holds the data, and that pointers to other objects (in PHP) are numeric references to a Table Index in MySQL).
I some time back found a neat class in the PEAR library (DB_DataObject: http://pear.php.net/package/DB_DataObject ) but could not get it to work, and anyway it seems pretty an overkill for my small applications... I don't need class-factories, thousands of config-files and stuff like that. I need a fast little library with a class I can extend with my own classes so that I can dynamically load the data from the tables into my classes, then work on those classes and at a later moment, maybe save them back to the database.

Does anyone know such a class? It would really help me a lot :)

Snyke
Avatar of Marcus Bointon
Marcus Bointon
Flag of France image

I've run into this before and not found a solution. Although my classes usually have a 1:1 relation with a DB record, sometimes they don't, and I use a class to represent something that's expressed as multiple records in several tables without using yet more classes. I still have trouble with the whole OO vs relational models thing - I'd love to see a way of building a factory class that doesn't have to know about the internal structure of the objects it's creating.
Avatar of Snyke
Snyke

ASKER

I often have classes that represent Data-Objects, and an abstraction layer would be really wonderfull. PEAR::DB_DataObject would really be nice, but I can't get it to run and nobody on this board could tell me how to do it, so I'm asking for an alternative...
ASKER CERTIFIED SOLUTION
Avatar of Marcus Bointon
Marcus Bointon
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Accept Squinky's solution

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

- Neester -
EE Cleanup Volunteer