Unable to convert self-referring instances to resources#22
Merged
weierophinney merged 11 commits intoDec 21, 2020
Conversation
weierophinney
left a comment
Contributor
There was a problem hiding this comment.
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.
| * @param ServerRequestInterface $request | ||
| */ | ||
| public function fromObject($instance, ServerRequestInterface $request) : HalResource | ||
| public function fromObject($instance, ServerRequestInterface $request, int $depth = 0) : HalResource |
Contributor
There was a problem hiding this comment.
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.
7 tasks
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 $depthwith default value)