Note that there are some explanatory texts on larger screens.

plurals
  1. PODoctrine 1.2 class table inheritance workaround?
    text
    copied!<p><br> ok, first of all, I know this is not possible with 1.2., that is why I'm looking for a workaround.<br> And no, unfortunately I can't use Doctrine 2, because my shared hosting server is stuck at PHP 5.2.16, and the admin refuses to install PHP 5.3 support.</p> <p>So, here is my problem, basic parent-child issue:<br> Lets say I have a base class <code>User</code> and child classes <code>Customer</code>, <code>Seller</code>, <code>Admin</code>.</p> <p>I have been looking at the inheritance methods: <em>simple</em> (pretty useless IMO), <em>concrete</em> and <em>column aggregation</em>, and even a workaround for "<em>fake class table inheritance</em>" found <a href="http://www.doctrine-project.org/blog/using-behaviors-to-share-relationship-properties" rel="nofollow">here</a>.</p> <p>What I really need is "<em>class table inheritance</em>", in other words <code>User</code> maps to separate table, which contains all shared values, and child tables define map to separate tables defining only their specific columns.</p> <p>I have given up on <em>perfection</em> :) in PHP&lt;5.3, I really don't care how will it be stored in the db, but my object model NEEDS to have all functionality.</p> <p>So what is the best choice for a workaround? </p> <p>This is what I need.</p> <ul> <li>Base class definition with shared values (name, username, password, address...)</li> <li>Child classes with all the values (shared and their specific)</li> <li>Child classes should only <em>see</em> their variables, not from other child classes (for instance, Customer should not have <code>workingHours</code> defined, which is a Seller specific value)</li> <li>I have to be able to form relationships on the base class, and on the separate child classes, and these relationships have to be bind to the specific class (for instance User class has to have a relationship to the Address class, Restourant class has to have a relationship to the Orders class, Restourant also has to have the Address relationship defined... but Admin can't have a Orders relationship, because he has nothing to do with orders)</li> </ul> <p>Querying the base table would also be nice, but as I can see this is one of the biggest problems, it is not a must have.</p> <p>I hope you understand my question. Any advice would be appreciated, because I really don't know what to do here.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload