-
Notifications
You must be signed in to change notification settings - Fork 26
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
Allow iterating over a collection to generate links #35
Comments
What about something like
or
|
Yeah. I like that. Now, the problem is: The |
If you don't have a way to access the parent object from this object, there is no way to build a property path for it (or to retrieve the value when the tool has your object) |
No, I think I wasn't clear in my previous comment. Let me give you an example: /**
* @Relations(
* @Relation("author", href = @Route("author",
* "parameters" = { "bookId" = "id", "authorId" = "id" })),
* "property" = "author"
* )
*/
class Book
{
private $id;
private $authors; // That's the collection
} How do you now distinguish between taking the |
You traverse the graph back:
|
If that actually exists, or, something like this: /**
* @Relations(
* @Relation("author", href = @Route("author",
* "parameters" = { "bookId" = "id" })),
* "property" = { "author" = { "authorId" = "id" } }
* )
*/
class Book
{
private $id;
private $authors; // That's the collection
} |
One year later, ping ? |
I would advise to use the new hateoas library : https://github.com/willdurand/Hateoas/blob/master/tests/Hateoas/Tests/Fixtures/AdrienBrault.php#L56-L61 |
We should be able to generate links off of collections, so you would specify a parameter to create a link for each element in that array.
For example, you have an array of authors, and you want to generate a link for each author
The text was updated successfully, but these errors were encountered: