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

Orm Support Inheritance #8

Open
shibasawa opened this issue Apr 17, 2012 · 2 comments
Open

Orm Support Inheritance #8

shibasawa opened this issue Apr 17, 2012 · 2 comments

Comments

@shibasawa
Copy link

Is there any chance for the Orm Model to detect parent object variables and take them as table columns? For the current version I have tried it. Not supported.

@ziminji
Copy link
Owner

ziminji commented Apr 21, 2012

Yes, I will look into it for you. However, as a work around, you can do the following:

+ (NSDictionary *) columns {
    return [NSDictionary dictionaryWithObjectsAndKeys: @"NSNumber", @"pk", @"NSString", @"name" nil];
}

This should allow you to create subclasses.

@gopalraichur
Copy link

In ZIMOrmModel.m, I added the following code just before the return statement in the +columns selector

Class superClass = [self superclass];
if(superClass != [ZIMOrmModel class])
{
    Method columnsMethod = class_getClassMethod(superClass, @selector(columns));
    if(columnsMethod != NULL)
    {
        NSDictionary *superColumns = [superClass columns];
        [columns addEntriesFromDictionary:superColumns];
    }
}

Works just fine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants