Also, if the purpose is ordinary ORM, then I'd suggest
class ormbase {
public function __construct($id) {
$qry = 'SELECT * FROM ' . get_class($this) . ' WHERE id = ' . $id;
/* or, if it's important to allow id fields named something other than id
why not base them on the table name at least */
$cn = get_class($this);
$qry = 'SELECT * FROM ' . $cn . ' WHERE id = ' . $cn . '_' . $id;
}
}
/* But this appraoch also means you'd have to drop the more or less anonymous
tablea, tableb and tablec naming */
class Domain extends ormbase {
public function __construct($id) {
parent::construct($id);
}
}
And you'd of course want to add automated retrieval from the db based on member properties as well.
Stick to one naming convention:
Domain_ID, link_id, Target_Domain_id
Could be:
Domain_ID, Link_ID, Target_Domain_ID
Or:
domain_id, link_id, target_domain_id
Or:
Domain_id, Link_id, Target_Domain_id
It's your choice, but do make one and stick to it.
Perhaps it works no matter when you use caps or not on your current db, but that won't necessarily always be the case.