-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
The Parent-Child (self) relationship is visible only on first page in pagination. #36
Comments
https://github.com/Vanguard-Intl/mezzio-tutorial Here's the repo. |
@goharsahi |
@froschdesign
And below is the expected behaviour.
When the same record is seen on http://localhost:8080/banks?page=1 (by increasing the page size in config.local.php file), it works perfectly fine. |
@froschdesign any feedback on this issue? |
This might be labelled as Feature Request as the actual behaviour is correct as per Section 4 and 4.1.2 of the rfc draft. As the extraction of data is done by one single hydrator per resource object i don't see a way to differentiate between "normal data" and embedded data yet. You could solve your problem by writing a custom // snip... see RouteBasedResourceStrategy
$embed = ['parent' => $data['parent']];
// prevent data collision
unset($data['parent']);
return new HalResource($data, [
$resourceGenerator->getLinkGenerator()->fromRoute(
'self',
$request,
$metadata->getRoute(),
$routeParams
),
], $embed); I'd probably do it with a second hydrator instead of this "array hack". Not extracting the parent property with the |
Bug Report
The Parent-Child (self) relationship isn't working properly
Summary
The Parent-Child (self) relationship isn't working properly in pagination.
Current behavior
While listing the parent-child data of an Entity, parent data is visible only on first page. In rest of the pages only original data is visible along with following portion.
How to reproduce
http://localhost:8080/banks or http://localhost:8080/banks?page=1 lists following data.
And http://localhost:8080/banks?page=2 shows following data.
See the difference of portion starting from
Expected behavior
http://localhost:8080/banks?page=1
http://localhost:8080/banks?page=2
The text was updated successfully, but these errors were encountered: