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
custom primary key #639
Comments
That currently isn't possible. We'll keep an eye for this in mr3.0. I have an idea how I can be done. Saul Sent from my iPad
|
@casademora can't this be done by using the |
This is definitely an issue I would love to see addressed! |
@nacrossweb, as @jostster said you can probably achieve your desired results by implementing |
@Alydyn & @jostster I don't think you can. I think what you suggest is fine for any value other than the primary key. If So you can concatenate multiple values into one, but not use this value as a primary key value. Further more in 2.2 the managed object is always fetched using the primary keys value from the So if this data doesn't contain your primary key, you are currently out of luck, as far as I understand. |
First, you should use 2.3beta5 or even better, the develop branch.
He doesn't mention this use case but I don't see why you couldn't implement |
Hi @Alydyn thanks for following this up. Is 2.3beta5 production ready? I checked cocoapods.org and the latest official version recorded there is 2.2.
There are two main ways I see this issue being resolved.
Implementing this method and returning a new object could replace the original dataObject used for all subsequent data import calls. I think this is superior to injecting values back into the original data, which is especially problematic if you are working with some deep immutable structure.
i.e I think option 1 is probably easier to retrofit in and is perhaps useful in of it self, but option 2 would be a more explicit approach to solving this problem. |
Hi,
is it possible to use a custom primary key for my MagicalRecord entity? In my case, the primary key is a concatenation of two json attributes and not just one.
cheers,
Jan
The text was updated successfully, but these errors were encountered: