{"action":"created","issue":{"url":"https://api.github.com/repos/tanis2000/MTLFMDBAdapter/issues/5","labels_url":"https://api.github.com/repos/tanis2000/MTLFMDBAdapter/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/tanis2000/MTLFMDBAdapter/issues/5/comments","events_url":"https://api.github.com/repos/tanis2000/MTLFMDBAdapter/issues/5/events","html_url":"https://github.com/tanis2000/MTLFMDBAdapter/issues/5","id":52656168,"number":5,"title":"FMDBColumnsByPropertyKey can return nil?","user":{"login":"todaylover","id":2224551,"avatar_url":"https://avatars.githubusercontent.com/u/2224551?v=3","gravatar_id":"","url":"https://api.github.com/users/todaylover","html_url":"https://github.com/todaylover","followers_url":"https://api.github.com/users/todaylover/followers","following_url":"https://api.github.com/users/todaylover/following{/other_user}","gists_url":"https://api.github.com/users/todaylover/gists{/gist_id}","starred_url":"https://api.github.com/users/todaylover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/todaylover/subscriptions","organizations_url":"https://api.github.com/users/todaylover/orgs","repos_url":"https://api.github.com/users/todaylover/repos","events_url":"https://api.github.com/users/todaylover/events{/privacy}","received_events_url":"https://api.github.com/users/todaylover/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-12-22T14:55:01Z","updated_at":"2015-01-13T09:05:43Z","closed_at":null,"body":"I just want to leave FMDBColumnsByPropertyKey return nil while using property keys as columns\r\n\r\n```objc\r\n   NSDictionary *columns = [model.class FMDBColumnsByPropertyKey];\r\n    NSArray *allValues = [columns allValues];\r\n    NSArray *allPropertyKeys = [columns allKeys];\r\n    NSString *propertyKey = nil;\r\n    NSIndexSet *idx = [allValues indexesOfObjectsPassingTest:^BOOL(NSString *obj, NSUInteger idx, BOOL *stop) {\r\n        if (![obj isKindOfClass:NSNull.class] && ([obj caseInsensitiveCompare:column] == NSOrderedSame)) return YES;\r\n        return NO;\r\n    }];\r\n    if (idx.count > 0 ) propertyKey = allPropertyKeys[idx.firstIndex];\r\n    NSAssert(propertyKey != nil, @\"Property key for column %@ is nil\", column);\r\n    return propertyKey;\r\n```\r\n\r\nand when inserting,  should valid the value instead of key\r\n\r\n```objc\r\n+ (NSString *)insertStatementForModel:(MTLModel<MTLFMDBSerializing> *)model {\r\n    NSDictionary *columns = [model.class FMDBColumnsByPropertyKey];\r\n\tNSSet *propertyKeys = [model.class propertyKeys];\r\n    NSArray *Keys = [[propertyKeys allObjects] sortedArrayUsingSelector:@selector(compare:)];\r\n    NSMutableArray *stats = [NSMutableArray array];\r\n    NSMutableArray *qmarks = [NSMutableArray array];\r\n\tfor (NSString *propertyKey in Keys)\r\n    {\r\n\t\tNSString *keyPath = columns[propertyKey];\r\n        keyPath = keyPath ? : propertyKey;\r\n        \r\n        if (keyPath != nil && ![keyPath isEqual:[NSNull null]])\r\n        {\r\n            [stats addObject:keyPath];\r\n            [qmarks addObject:@\"?\"];\r\n        }\r\n    }\r\n    \r\n    NSString *statement = [NSString stringWithFormat:@\"insert into %@ (%@) values (%@)\", [model.class FMDBTableName], [stats componentsJoinedByString:@\", \"], [qmarks componentsJoinedByString:@\", \"]];\r\n    \r\n    return statement;\r\n}\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/tanis2000/MTLFMDBAdapter/issues/comments/69714386","html_url":"https://github.com/tanis2000/MTLFMDBAdapter/issues/5#issuecomment-69714386","issue_url":"https://api.github.com/repos/tanis2000/MTLFMDBAdapter/issues/5","id":69714386,"user":{"login":"tanis2000","id":287841,"avatar_url":"https://avatars.githubusercontent.com/u/287841?v=3","gravatar_id":"","url":"https://api.github.com/users/tanis2000","html_url":"https://github.com/tanis2000","followers_url":"https://api.github.com/users/tanis2000/followers","following_url":"https://api.github.com/users/tanis2000/following{/other_user}","gists_url":"https://api.github.com/users/tanis2000/gists{/gist_id}","starred_url":"https://api.github.com/users/tanis2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanis2000/subscriptions","organizations_url":"https://api.github.com/users/tanis2000/orgs","repos_url":"https://api.github.com/users/tanis2000/repos","events_url":"https://api.github.com/users/tanis2000/events{/privacy}","received_events_url":"https://api.github.com/users/tanis2000/received_events","type":"User","site_admin":false},"created_at":"2015-01-13T09:05:43Z","updated_at":"2015-01-13T09:05:43Z","body":"Sorry but I don't get why you would want to set the column property key to nil. Could you please elaborate on that?"}}