Overriding insertInManagedObjectContext: will not affect child objects in movenerator: why and how to do this?

In the methods insertInManagedObjectContext:provided mogenerator, there are no calls for super-methods.

I wonder why.

Really,

  • Imagine that I have two objects: ParentEntityand ChildEntity; Of course, ParentEntityis the parent ChildEntity.
  • Then I redefine insertInManagedObjectContext: ParentEntity.
  • But then, when I create ChildEntity, not one of my changes will be taken into account!

I was wondering why such a choice and, possibly, a solution.



I need to create a super entity with children and that this super object has two insertion methods. I want these two insertion methods to be used by children.

0
source share
1 answer

Perhaps they just didn't think about it like you did.

What can you do, why not implement your own method to replace the place insertInManagedObjectContext:and make it call a super-implementation? Create files, then put your new method on ChildEntity.mand get a version of this version. You cannot use the same method name, as it _ChildEntity.mwill have one that does not call the super version. So use a different method name.

+1
source

All Articles