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

Unable to generate ordered relationships with feature/swift12 branch #290

Closed
tomburns opened this issue Jun 24, 2015 · 7 comments · Fixed by #292
Closed

Unable to generate ordered relationships with feature/swift12 branch #290

tomburns opened this issue Jun 24, 2015 · 7 comments · Fixed by #292

Comments

@tomburns
Copy link
Contributor

I'm having some difficulty getting mogenerator to generate correct machine classes for entities with ordered relationships. It's entirely possible that I'm missing something here, but every time I build feature/swift12 from HEAD and generate classes I end up with plain sets as opposed to the ordered sets I would expect.

I've created a sample project in which an ordered one-to-many relationship goes undetected: https://github.com/tomburns/CoreDataTest

It's entirely possible that I'm missing something; by all means let me know if this is a boneheaded mistake on my end!

for reference, the project was created with Xcode 6.3.2 and this is the mogenerator invocation i've been using:
~/bin/mogenerator --v2 --swift --model CoreDataTest/CoreDataTest.xcdatamodeld --output-dir CoreDataTest/

@tomburns tomburns mentioned this issue Jun 24, 2015
@tomburns
Copy link
Contributor Author

Anyone able to reproduce this? Am I holding it wrong? @justin @atomicbird

@tomburns
Copy link
Contributor Author

@justin (tagging you since you expressed an interest on twitter)

I dug into this a bit more this afternoon, setting some breakpoints in mogenerator's jr_isOrdered and interrogating the relationships. For some reason, NSRelationshipDescriptions that return YES for isOrdered in my app seem to be returning NO when mogenerator is run. This is occurring both with the sample app I linked above and my main application in which I discovered the issue.

@tomburns
Copy link
Contributor Author

LLDB output from within mogenerator:

(lldb) po [[model.entitiesByName objectForKey:@"Parent"] relationshipsByName]
{
    children = "(<NSRelationshipDescription: 0x100315080>), name children, isOptional 1, isTransient 0, entity Parent, renamingIdentifier children, validation predicates (), 
warnings (), versionHashModifier (null)\n userInfo {},
 destination entity Child, inverseRelationship parent,
 minCount 1, maxCount 0, isOrdered 0, deleteRule 1";
}

and the same relationship from the same model, from within the app:

(lldb) po mom.entities[1].relationshipsByName
[children: (<NSRelationshipDescription: 0x7f931af254d0>), name children, isOptional 1, isTransient 0, entity Parent, renamingIdentifier children, validation predicates (),
 warnings (), versionHashModifier (null) userInfo {}, 
destination entity Child, inverseRelationship parent, 
minCount 0, maxCount 0, isOrdered 1, deleteRule 1]

@otaran
Copy link
Contributor

otaran commented Jun 26, 2015

Hi @tomburns, I am also able to reproduce this bug. I used git-bisect and found out that this is a regression introduced in f0b1b32. /cc @atomicbird

otaran added a commit to otaran/mogenerator that referenced this issue Jun 26, 2015
Adds support for ordered relationships.
@otaran
Copy link
Contributor

otaran commented Jun 26, 2015

Excuse me @atomicbird, I read over your commit again and figured out you've completely reimplemented model parsing – great work!

otaran added a commit to otaran/mogenerator that referenced this issue Jun 26, 2015
Adds support for ordered relationships.
@tomburns
Copy link
Contributor Author

Yep, looks like it was introduced when the internal parser fork was merged at 73fccca.

@justin, @atomicbird, any thoughts on otaran's fix proposed above? I'm happy if it solves my immediate issue, but are there any tests which might indicate that other model features may not be picked up by the new parser?

fwiw, the ./test/ suite comes back clean when run against feature/swift12 HEAD:

~/c/s/m/test (feature/swift12) rake
*** Clean-building mogenerator
*** Testing MRC (with objc literals)
success
*** Testing MRC (without objc literals)
success
*** Testing ARC (with objc literals)
success
*** Testing ARC (without objc literals)
success

justin pushed a commit that referenced this issue Jun 29, 2015
Adds support for ordered relationships.
@justin
Copy link
Collaborator

justin commented Jun 29, 2015

This should be taken care of now.

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

Successfully merging a pull request may close this issue.

3 participants