Git Product home page Git Product logo

Comments (15)

dimazen avatar dimazen commented on June 19, 2024

@Ma-He
Hello there.

Can you share you mapping description and version?

I assume next case:
You've specified relationship at key "location" (let's assume")
Then Location entity get's created and passed to the cache. However, since there was no data in it - an empty Location is passed.

However, cache can't store objects without Primary Key.. so it crashes..

from fasteasymapping.

Ma-He avatar Ma-He commented on June 19, 2024

Hi,

yep, that's true. I've specified the location relationship as follows:

[mapping addRelationshipMapping:[self locationMapping]
                                                                   forProperty:PersonRelationships.location
                                                                       keyPath:PersonRelationships.location];

and my 'Location' mapping

+ (FEMManagedObjectMapping *)locationMapping
{
    return [FEMManagedObjectMapping mappingForEntityName:[Location entityName]
                                           configuration:^(FEMManagedObjectMapping *mapping) {
                                               [mapping addAttributeMappingDictionary:@{LocationAttributes.locationId : @"id",
                                                                                        LocationAttributes.houseNumber : @"streetNumber",
                                                                                        LocationAttributes.streetName : @"streetname"}];
                                               [mapping addAttributeMappingFromArray:@[LocationAttributes.city,
                                                                                       LocationAttributes.country,
                                                                                       LocationAttributes.latitude,
                                                                                       LocationAttributes.longitude,
                                                                                       LocationAttributes.zipCode]];

                                               mapping.primaryKey = LocationAttributes.locationId;
                                           }];
}

I'm using the current version 0.3.8

from fasteasymapping.

dimazen avatar dimazen commented on June 19, 2024

Basically, we don't have to create relationship if this key not found or represented as Null
Looks like a bug :)

from fasteasymapping.

Ma-He avatar Ma-He commented on June 19, 2024

That's just what I was thinking :-) First, I've assumed I've done something wrong with my mapping, but after some tests and different JSON representations it looks like a bug to me.
Thanks @poteryaysya for your help ;-)

from fasteasymapping.

dimazen avatar dimazen commented on June 19, 2024

@Ma-He
you can help me with pull request (if you'd like to!) ;)
i'll be ready closer to the end of the week

from fasteasymapping.

EsSpectacularrr avatar EsSpectacularrr commented on June 19, 2024

Having the same issue, had to add a null check.

from fasteasymapping.

dimazen avatar dimazen commented on June 19, 2024

@JacquesPienaar, @Ma-He
Just get back from my vacation.
I'll take a look in a few days

from fasteasymapping.

dimazen avatar dimazen commented on June 19, 2024

@Ma-He, @JacquesPienaar
Can you, guys, share JSON input for me?
Basically, it happens, when there is a mapping for some relationship, but no object presented in JSON, correct?

from fasteasymapping.

EsSpectacularrr avatar EsSpectacularrr commented on June 19, 2024

Correct

eg:

[mapping addToManyRelationshipMapping:[self promotion] forProperty:@"promotions" keyPath:@"promotions"];

json
"promotions": null

from fasteasymapping.

dimazen avatar dimazen commented on June 19, 2024

@JacquesPienaar thanks for help!

from fasteasymapping.

dimazen avatar dimazen commented on June 19, 2024

@JacquesPienaar
can reproduce it on to-one relationship, when key in JSON is missing.
it generate empty entity with nil fields. (which is obviously a bug)

from fasteasymapping.

dimazen avatar dimazen commented on June 19, 2024

@JacquesPienaar can you try 3e2f506?

Or give me some more info, because with NULL relationship it appears to be working correctly.
However with missing key it generated empty objects..

from fasteasymapping.

dimazen avatar dimazen commented on June 19, 2024

Resolved by #21

from fasteasymapping.

dimazen avatar dimazen commented on June 19, 2024

@Ma-He, @JacquesPienaar
I have some issues with my pod trunk session.
Meanwhile you can grab latest source by tag 0.4.0
I'll push it to the trunk as soon as permissions will be renewed

from fasteasymapping.

dimazen avatar dimazen commented on June 19, 2024

@Ma-He. @JacquesPienaar
0.4.1 should be available in Cocoapods, update repo :)

from fasteasymapping.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.