Skip to content
This repository was archived by the owner on Mar 1, 2020. It is now read-only.
This repository was archived by the owner on Mar 1, 2020. It is now read-only.

Problem with entities with a superentity #3

@alessandroorru

Description

@alessandroorru

If in your CoreData model you have an entity that inherits from another one, the properties of the parent entity will be added on both the parent and the child extensions. This causes a failure during compilation, because properties in extensions can't be overridden.

The correct behavior should be to write the properties only for the parent entity extension.

Example with "superentity" with a "subentity" child:

extension Superentity {
  static var test:Attribute<NSNumber> { return Attribute("test") }

  class func queryset(context:NSManagedObjectContext) -> QuerySet<Superentity> {
    return QuerySet(context, "Superentity")
  }
}

extension Attribute where AttributeType: Superentity {
  var test:Attribute<NSNumber> { return attribute(AttributeType.test) }
}

This inherits from Superentity:

extension Subentity {
  static var test:Attribute<NSNumber> { return Attribute("test") } // This causes a failure

  class func queryset(context:NSManagedObjectContext) -> QuerySet<Subentity> {
    return QuerySet(context, "Subentity")
  }
}

extension Attribute where AttributeType: Subentity {
  var test:Attribute<NSNumber> { return attribute(AttributeType.test) } // This causes a failure
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions