-
Notifications
You must be signed in to change notification settings - Fork 109
Fetching relationships objects #127
Comments
It seems that there are alternatives such as:
or
Which both produce URL's which can't be paginated. |
Or perhaps being able to get that URL as: ... |
Does PS: |
Thanks @wvteijlingen. This has worked for instances when the relationship includes the appropriate links. However there are instances when we have the ids and type of a relationship defined & we'd like to resolve a resources relationship. },
"relationships":{
"skills":{
"data":[
{
"id":"59451a73-1e14-464d-a4a0-7136ec2bf644",
"type":"skills"
},
{
"id":"4c43fb46-a5d1-471a-ad87-a4289bccc939",
"type":"skills"
},
{
"id":"a7e91fb3-8113-434b-a8e4-4d1f1e169992",
"type":"skills"
}, If I expose the var skillIds: [String]
skillIds = selectedJobCategories.reduce([], { (results, jobCategory) -> [String] in
var results = results
results.append(contentsOf: jobCategory.skills!.linkage!.reduce([], { (results, resourceIdentifier) -> [String] in
var results = results
results.append(resourceIdentifier.id)
return results
}))
return results
})
SpineSingleton.find(skillIds, ofType: Skill.self).onSuccess { [weak self] in It would be sweet if this were available as a query & resolve the relationships on the fetching resource...? |
This is infact a better alternative for us: var query = Query(resourceType: Skill.self)
selectedJobCategories.forEach { (jobCategory) in
query.whereRelationship("jobCategory", isOrContains: jobCategory)
}
SpineSingleton.find(query).onSuccess { [weak self] in |
I hit a similar issue this morning, but to solve my case I just need access to the ResourceIdentifier struct's id property. Does anyone know why that is made to be private? |
Let's say I have an object
Timesheet
which has a relationshipEntries
of 100 objects.Our API expects a URI as:
/timesheets/1234/entries
Is there a way for Spine to generate the appropriate URL without concating a URL as so:
The text was updated successfully, but these errors were encountered: