ORM

From Qubit Toolkit
Jump to: navigation, search

There's a lot of repetitive code for accessing referring foreign keys. First, we don't use all of these, so it'd be nice if the ORM allowed us to configure which we want to use.

Now that some of this code is collected in the __isset() and __get() magic methods, we could remove some duplication with a foreach loop. Unfortunately this would leave duplication between classes and sub classes. The way to eliminate this is the way we eliminated duplication for column values, using the propel map classes.

Unfortunately, I think the only way to get a list of referring foreign keys is to iterate over every table in the database : (

$object->i18nProperty depends on $object->i18n, so $object->i18n *must* be defined first in __get()

->refFkValues should be cleared on ->clear(), but isn't cleared on ->save(), so lines up with ->row?

->save() can only clear ->refFkValues if it also clears ->row, because otherwise ->save()->clear() doesn't iterate over linked objects

[edit] ORM classes

Table: ORM classes, ordered to minimize foreign key reference violations
ORM Class Foreign Keys Constant Ids Extends QubitObject I18n table Notes
QubitObject - no no no Not explicitly inserted in YAML
QubitTaxonomy - yes no yes  
QubitTerm Taxonomy yes
ROOT_ID: 110
yes yes  
QubitActor <self>, Term (x3) no yes yes  
QubitRepository (extends) Actor, Term (x3) no yes yes  
QubitInformationObject <self>, Repository, Term (x4) ROOT_ID: 1 yes yes  
QubitDigitalObject <self>, IO, Term (x3) no yes no  
QubitEvent IO, Actor, Term no yes yes  
QubitFunction <self>, Term (x3) no yes yes  
QubitPhysicalObject <self>, Term (x3) no yes yes  
QubitStaticPage - no yes yes  
QubitUser (extends) Actor no yes no  
QubitObjectTermRelation <Object>, Term no yes yes  
QubitOtherName Object, Term no yes yes  
QubitRelation <Object>, <Object>, Term no yes no  
QubitAclGroup <self> no no yes  
QubitAclUserGroup User, Group yes no no  
QubitAclPermission User, Group, Object no no no  
QubitContactInformation Actor no no yes Must come after QubitRepository
QubitMenu <self> yes no yes  
QubitNote <self>, <Object>, User, Term no no yes Must come after Relation, Event, ObjectTermRelation, etc.
QubitOaiRepository - no no no  
QubitOaiHarvest OaiRepository no no no  
QubitProperty <Object> no no yes  
QubitSetting - no no yes  
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox