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

Route identifier_name should be a property of the metadata map #112

Open
macnibblet opened this issue Sep 17, 2013 · 2 comments
Open

Route identifier_name should be a property of the metadata map #112

macnibblet opened this issue Sep 17, 2013 · 2 comments

Comments

@macnibblet
Copy link
Contributor

According to the documentation here https://phlyrestfully.readthedocs.org/en/latest/ref/advanced-routing.html one should use a metadata_map instead of using listeners.

But according to this line: https://github.com/phly/PhlyRestfully/blob/master/src/PhlyRestfully/Plugin/HalLinks.php#L558
It's extracted from the metadata identifier_name that represents the identifier for the object and not the route.
thus the metadata_map can currently not solve the child routes properly.

My suggestion would be to add another parameter to the metadata mapping route_identifier_name and if it's not set assume the same as identifier_name

Suggestions on a fix @weierophinney ?

@Wilt
Copy link
Contributor

Wilt commented Oct 2, 2013

I agree, this seems inconsistent. At one point identifier_name it is representing a route id and later an object id. It took me some time to figure this out. Another solution would be to let the identifier_name in the meta data map represent the route identifier (like done in the resource definitions) and use the getIdFromResource function defined at line 865 to get the identifier out of the object like done similarly on line 581: $id = $this->getIdFromResource($resource);

https://github.com/phly/PhlyRestfully/blob/master/src/PhlyRestfully/Plugin/HalLinks.php#L581

This solution would actually mean replacing line 544 to 552 by the same code as on line 581 to 587

@glennschmidt
Copy link

+1 i've run up against this issue also. The name of the identifier key on the resource won't necessarily be the same as the identifier key on the route.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants