Women in Technology

Hear us Roar



Article:
  Simplify Business Logic with PHP DataObjects
Subject:   DataObject per table
Date:   2005-06-21 13:17:50
From:   raminoacid
After reading the comments (I may be late though, it's 2005), I noticed that my implementation is sort of abstract/general and sort of NOT.


I'm using PHP4 so I had to 'carve' some OOP in my classes. My DataObject is a base-class for all other DataObject's. I only created subclasses for the relation tables to make them more flexible in showing their rows. Instead of showing PK values, they refer to the corresponding table and show the readable values.


I totally see Evil3's opinion but in my case, the subclasses are really for specific table-related stuff. Don't make DO's for each table unless you have to ... or have a better solution.


Cheers.

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • DataObject per table
    2005-07-01 14:18:49  y11o [View]

    you might be interested in seeing the EZPDO project (http://www.ezpdo.net) and especially this post (http://www.ezpdo.net/forum/viewtopic.php?id=20) which talks about exactly the problem you try to solve.


    [Excerpt from the post]

    The class hierarchy looks like this.


    Graphic -+- Point
    |
    +- Line
    |
    +- Text


    This is a simple example of the Composite design pattern. Each Graphic object can have
    a parent Graphic object and a set of child Graphic objects. EZPDO can persist all the
    composition relationships and you will find it is fairly easy to do with EZPDO.