Re: Setting up horizontal inheritance
Re: Setting up horizontal inheritance
- Subject: Re: Setting up horizontal inheritance
- From: Paul Hoadley <email@hidden>
- Date: Sun, 2 Nov 2008 13:21:38 +1030
On 02/11/2008, at 10:55 AM, Chuck Hill wrote:
Maybe I should take a step back. I assumed I wanted inheritance
at all because I have a basic EO called Person in a model in a
utility framework, and in a particular app I want to add three
relationships to app-specific EOs. (In other apps, Person might
be sufficient as it is, and I would instantiate it as an EO.) Is
this an example of where one would use inheritance? Is HI a bad
choice, and should I use STI instead?
I'd probably use HI in this case. I might also just dynamically add
the relationships when the models are loaded.
I didn't even know that was possible.
HI is less tricky.
I've implemented it using HI, and it seems to be working. I'm not
convinced I have it quite right, though. There's another EO in the
utility-framework's model, UserPreference. UserPreference has a to-
one relationship with Person to denote the owner of the preference.
In the particular app, though, I'm now using AMPersons, and hence the
amperson table in the database---but UserPreference.person
relationship obviously looks for a Person in the 'person' table, and
there aren't any. To overcome this, I have sub-classed UserPreference
to create AMUserPreference, with the only change being that the person
relationship points to AMPerson. This seems inelegant to me---am I
doing it right? (Or is this a candidate for the kind of dynamic model
change you refer to above?)
--
Paul.
w http://logicsquad.net/
h http://paul.hoadley.name/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden