PEAR::DB_DataObject

One of the PEAR modules I’ve been making extensive use of is DB_DataObject. For a while I toyed with writing a custom DataObject system for the current project, but PEAR’s offering seemed to have pretty much everything I was looking for. Overall, it’s made the development process much more straightforward than it would otherwise have been, but I did run into one unexpected problem. I have a lot of table links specified in the configuration file and I suddenly discovered that some of those links weren’t being made as I expected. It turns out that DataObject loads all the links into an associative array, indexed by the field being linked. This means that if, say, you have a member id linking to a whole variety of tables then only the last link specified will be recorded. ...

PEAR::DB_NestedSet

For a current project I’m trying to get a better idea of what’s available in PEAR. PEAR has come on a long way since I last explored it in any seriousness. Today’s undertaking was an exploration of DB_NestedSet. Up till now I’d had a simple parent-child category map but I needed to make it a little more flexible, reduce database overheads and simplify maintenance. Using NestedSet looks like a solution to all of those, though some refactoring may be in order. The key thing that’s missing is good documentation and it did take a fair bit of googling to get things going as I’d like. ...