Re: How to create subentity object inheriting from superentity object in core data
Re: How to create subentity object inheriting from superentity object in core data
- Subject: Re: How to create subentity object inheriting from superentity object in core data
- From: Ben Trumbull <email@hidden>
- Date: Thu, 17 Sep 2009 12:43:46 -0700
On Sep 17, 2009, at 9:21 AM, Leon Starr wrote:
So, going back to my example, (and the part everyone disagrees
with!) I still don't get it. More importantly, my objc compiler
doesn't get it! In the model, Auto.license is properly inherited by
the Sedan and Truck subentities. No trouble at all with KVC
interactions. But if there is no @property/@dynamic for license in
my Truck subclass, (only in the Auto subclasss) I cannot access
thisTruck.license without getting a compiler error. Which makes
total sense to me since one NSManagedObject subclass (Truck) is not
inheriting from another (Auto) in objc. They each inherit from
NSObject. But I CAN do [thisTruck valueForKey:@"license"], which
also makes perfect sense.
This violates the rule that a subentity must use an Objective-C class
that is the same as its superentity, or a subclass of its
superentity's Objective-C class.
If the Truck entity is a subentity of Auto, then it may reuse the
AutoClass, or a TruckClass which must be a subclass of the AutoClass.
- Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden