Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Comments

Update relationships with resource#106

Merged
pixelhandler merged 7 commits intomasterfrom
update-relationships-with-resource
Sep 25, 2016
Merged

Update relationships with resource#106
pixelhandler merged 7 commits intomasterfrom
update-relationships-with-resource

Conversation

@pixelhandler
Copy link
Owner

@pixelhandler pixelhandler commented Sep 22, 2016

In addition to persisting relationship changes separately from PATCH'ing a resource's attribute(s) by using the the service (adapter) methods mentioned above, the updateResource has an optional second parameter includeRelationships to provide an array with a list of relationship names that should be PATCH'd using the resource's link (endpoint). This optional argument, provides a way to update attributes and/or relationships together using the main endpoint for the resource.

For example to update the relationships with any changed attributes for a resource use: service.updateResource(resource, ['author', 'comments']) (where service is the injected service for the resource instance.

  • Add relationship change tracking to the Resource
  • Add rollbackRelationships method
  • Change rollback to call both rollbackAttributes and rollbackRelationships
  • Add changedRelationships property and relationMetadata method to Resource
  • Add new relationship serialization methods
  • Add optional second parameter includeRelationships to ApplicationAdapter#updateResource method to patch relationships
    • Opt into what relationships to patch using an array of the relationships (names, e.g. ['author', 'comments']

@pixelhandler pixelhandler changed the title WIP: Update relationships with resource Update relationships with resource Sep 25, 2016
@pixelhandler pixelhandler merged commit 83ba70b into master Sep 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant