Skip to content

Commit

Permalink
Don't generate -primativeType and -setPrimativeType:. Closes #202.
Browse files Browse the repository at this point in the history
  • Loading branch information
rentzsch committed Sep 17, 2014
1 parent 02bca8c commit 4ef709c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions templates/machine.m.motemplate
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const struct <$managedObjectClassName$>UserInfo <$managedObjectClassName$>UserIn
}
<$endif$>

<$if Attribute.name != "type"$>
- (<$Attribute.scalarAttributeType$>)primitive<$Attribute.name.initialCapitalString$>Value {
NSNumber *result = [self primitive<$Attribute.name.initialCapitalString$>];
return [result <$Attribute.scalarAccessorMethodName$>];
Expand All @@ -90,6 +91,7 @@ const struct <$managedObjectClassName$>UserInfo <$managedObjectClassName$>UserIn
}
<$endif$>
<$endif$>
<$endif$>
<$endforeach do$>

<$foreach Relationship noninheritedRelationships do$>
Expand Down
2 changes: 2 additions & 0 deletions test/test.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ int main(int argc, char *argv[]) {
ChildMO *bart = [ChildMO insertInManagedObjectContext:moc];
bart.humanName = bart.childName = @"bart";
[bart setIvar:1.0];
bart.type = [NSNumber numberWithInt:64];
bart.typeValue++;

ChildMO *lisa = [ChildMO insertInManagedObjectContext:moc];
lisa.humanName = lisa.childName = @"lisa";
Expand Down
6 changes: 3 additions & 3 deletions test/test.xcdatamodel/contents
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="6220.8" systemVersion="13E28" minimumToolsVersion="Xcode 4.5" macOSVersion="Automatic" iOSVersion="Automatic">
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="6244" systemVersion="13E28" minimumToolsVersion="Xcode 4.5" macOSVersion="Automatic" iOSVersion="Automatic">
<entity name="Child" representedClassName="ChildMO" parentEntity="Human" syncable="YES">
<attribute name="childName" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="type" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="type" optional="YES" attributeType="Integer 16" defaultValueString="0" syncable="YES"/>
<relationship name="parent" optional="YES" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="Parent" inverseName="children" inverseEntity="Parent" indexed="YES" syncable="YES"/>
</entity>
<entity name="ConcreteEntityWithCustomClass1" representedClassName="ConcreteEntityWithCustomClass1" parentEntity="EntitySansCustomClass2" syncable="YES">
Expand Down Expand Up @@ -79,7 +79,7 @@
<element name="EntitySansCustomClass" positionX="502" positionY="90" width="128" height="60"/>
<element name="EntitySansCustomClass2" positionX="295" positionY="-189" width="128" height="58"/>
<element name="EntityWithBaseClass" positionX="342" positionY="18" width="128" height="60"/>
<element name="Human" positionX="169" positionY="18" width="128" height="135"/>
<element name="Human" positionX="169" positionY="18" width="128" height="133"/>
<element name="Parent" positionX="34" positionY="114" width="128" height="283"/>
</elements>
</model>

7 comments on commit 4ef709c

@XBeg9
Copy link

@XBeg9 XBeg9 commented on 4ef709c Sep 19, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is brakes models if we have attribute with name "type".
_message m 2014-09-19 15-59-18 2014-09-19 15-59-25

@rentzsch
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, mogenerator's test/test.xcdatamodel's Child has a type attribute also of int16_t and HEAD passes the tests.

@dmdeller
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixed it for me. Thanks.

@XBeg9 To get this fix, make sure to install with brew install --HEAD mogenerator

@otaran
Copy link
Contributor

@otaran otaran commented on 4ef709c Jan 20, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rentzsch maybe you could release this as 1.28.1? It is almost 4 months since last release, and this fix is important enough to release it IMO. What do you think?

@joshorr
Copy link

@joshorr joshorr commented on 4ef709c Feb 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree 100%, just ran into this.

@faken
Copy link

@faken faken commented on 4ef709c May 23, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i also ran into this issue! Please release 1.28.1.
Even worse: brew install --HEAD mogenerator has a problem with ordered relations -> generates a unordered property to access the relation :(

@epologee
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a workaround, you could rename your attribute to have a prefix, like activityType. That will solve your issues faster than demanding a fix.

Please sign in to comment.