Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mmower opened this issue Apr 17, 2012 · 4 comments
Closed

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

mmower opened this issue Apr 17, 2012 · 4 comments
Milestone

Comments

@mmower
Copy link

mmower commented Apr 17, 2012

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
Copy link
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
Copy link
Author

mmower commented Apr 17, 2012

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
Copy link
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
Copy link
Contributor

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 as completed Oct 8, 2012
ddrccw pushed a commit to ddrccw/mogenerator that referenced this issue Jan 20, 2014
…ty string) it should be considered to not have a custom subclass. Recent versions of Xcode use the empty string as default class for entities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants