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

Broken self links when using RouteBasedResourceStrategy with resource identifiers that are objects #34

Open
emily-dawson opened this issue Jan 15, 2021 · 0 comments
Assignees
Labels

Comments

@emily-dawson
Copy link

BC Break Report

Q A
Version 1.4.0

Summary

When using RouteBasedResourceStrategy, the generated self link for individual HAL resources is broken when the resource identifier references a property that contains an object, regardless of whether the object can be represented as a scalar value. In my specific case, I am using the ramsey/uuid-doctrine library which represents the ID as an object once the entity is hydrated with data from the database.

Previous behavior

Due to this library not previously checking explicitly for scalar values in RouteBasedResourceStrategy::createResource, and the UUID objects employing __toString (and other serialisation methods), the UUID object was accepted and the self links were generated as expected.

Current behavior

The property value of a mapped resource containing such an object is not passed through as a route parameter in RouteBasedResourceStrategy::createResource like it was before, resulting in the self link being broken. After updating from 1.3.1 to 1.4.0, all the self links are showing paths such as /some-resource/%7Bid%7D, instead of the value of the field (e.g. /some-resource/1b7e838c-5758-11eb-b1fe-0242281aebdd).

How to reproduce

It seems like this was a change specifically made as a result of a test in this library (commit a05bd84). Attempting to use a non-scalar value in this scenario, as described above, should suffice.

@weierophinney weierophinney added this to the 1.4.1 milestone Jan 15, 2021
@weierophinney weierophinney self-assigned this Jan 15, 2021
@froschdesign froschdesign removed this from the 1.4.1 milestone Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants