-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Unable to convert self-referring instances to resources #22
Unable to convert self-referring instances to resources #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to target 2.0.0. I'm creating a 2.0.x branch now, and will rebase this against it for you momentarily.
@@ -124,7 +124,7 @@ public function fromArray(array $data, string $uri = null) : HalResource | |||
* against types registered in the metadata map. | |||
* @param ServerRequestInterface $request | |||
*/ | |||
public function fromObject($instance, ServerRequestInterface $request) : HalResource | |||
public function fromObject($instance, ServerRequestInterface $request, int $depth = 0) : HalResource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a BC break. Classes extending this one and defining using the previous signature will produce a warning under PHP 7, and a fatal under PHP 8, due to signature mismatch. We'll need to target next major for this.
Signed-off-by: Tobias Trozowski <tobias@trozowski.com>
Signed-off-by: Tobias Trozowski <tobias@trozowski.com>
Signed-off-by: Tobias Trozowski <tobias@trozowski.com>
Signed-off-by: Tobias Trozowski <tobias@trozowski.com>
Signed-off-by: Tobias Trozowski <tobias@trozowski.com>
Signed-off-by: Tobias Trozowski <tobias@trozowski.com>
…erring instances Signed-off-by: Tobias Trozowski <tobias@trozowski.com>
Signed-off-by: Tobias Trozowski <tobias@trozowski.com>
Also adds `ProphecyTrait` to test case to remove warning. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
…()`. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Description
Additional examples:
One-To-One, Bidirectional
One-To-One, Self-referencing
One-To-Many, Bidirectional
One-To-Many, Self-referencing
Many-To-Many, Bidirectional
Many-To-Many, Self-referencing
The zfcampus/zf-hal component solved this issue by using a $maxDepth property in metadata which is then passed through here and here.
Using this approach will result in a change of the \Zend\Expressive\Hal\ResourceGenerator\StrategyInterface interface which is a BC break.
This PR is based on my original PR in zend-expressive-hal.
The following public methods changed (added new argument
int $depth
with default value)