Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

mogenerator creates invalid files for an entity with no class #105

Closed
mmower opened this Issue · 4 comments

3 participants

@mmower

I have an entity that I do not want to generate a managed object subclass for so I leave Class blank.

I'd hoped that mogenerator would ignore this entity but, instead it generates files:

.h
.m
_.h
_.m

which I then have to delete. I suppose I could just create a class and ignore it but I'd really prefer either an option to exclude this entity or (preferably) for mogenerator to ignore entities with no class defined.

@rentzsch
Owner

Instead of leaving Class field blank, try setting it to NSManagedObject (that's what Xcode's Data Modeler sets it to for new entities sans custom classes).

@mmower

When I said "blank" perhaps I was misstating. What I mean is that it's blank, ergo it takes the default value of NSManagedObject (that's what I see in the field).

@rentzsch
Owner

Hmm, that should work. mogenerator's Test Mule subproject has a an entity without a custom class just to test that (EntitySansCustomClass in https://github.com/rentzsch/mogenerator/tree/master/mogeneratorTestMule/mogeneratorTestMule_DataModel.xcdatamodel).

Do you have the same problem with Test Mule's datamodel?

@mattbauch mattbauch referenced this issue from a commit
Matthias Bauch fix for #105 - If the class name of an entity is "" (i.e. empty strin…
…g) it should be considered to not have a custom subclass. Recent versions of Xcode use the empty string as default class for entities.
874921e
@mattbauch

Just had the same issue. When you delete the class from the Class field Xcode shows the grayish class name NSManagedObject.
However, the entity definition in the xcdatamodel contents actually looks like this:

<entity name="Client" representedClassName="" parentEntity="CoreDataObject" syncable="YES">

Notice that it doesn't have a representedClassName.
Putting NSManagedObject into the class field fixes this, the entity definition then looks like this, which does not produce _.h, _.m, .h and .m

<entity name="Client" representedClassName="NSManagedObject" parentEntity="CoreDataObject" syncable="YES">

Since representedClassName="" seems to be the new default (at least for Xcode 4.5), mogenerator should handle this correctly.

@rentzsch rentzsch closed this
@ddrccw ddrccw referenced this issue from a commit in ddrccw/mogenerator
Matthias Bauch fix for #105 - If the class name of an entity is "" (i.e. empty strin…
…g) it should be considered to not have a custom subclass. Recent versions of Xcode use the empty string as default class for entities.
4cd0763
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.