Closed snusnu closed 10 years ago
I've decided that this is not worth the complexity needed to support this kind of thing. Instead, it should be possible to simply give the Relation::Registry
a blacklist of datamapper models for which it should not register base relations.
This will in turn allow schema authors to simply add the restricted base relations for the respective STI subclasses themselves.
Generate
For this to work, we need a mapping of STI hierarchy models to their respective name, base relation name and discriminator column (the discriminator value is inferred from the mapping key, i.e. the model name).
Given a mapping like this:
Compiles the following relation access methods into the schema:
This is also necessary, because all STI hierarchy models share the same
storage_name
, which means that for every STI hierarchy withinDataMapper::Model.descendants
, mappings need to be declared for the base model and all leaf models.