-
-
Notifications
You must be signed in to change notification settings - Fork 244
!!! FEATURE: Render ResponseInterface directly in Fusion Views
#4856
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
Merged
mhsdesign
merged 31 commits into
neos:9.0
from
mhsdesign:feature/fusionRuntimRenderHttpResponse
Apr 24, 2024
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
53c3ed4
WIP: FEATURE: Fusion Runtime render directly http response
mhsdesign bd64cdd
WIP: Neos Fusion View use Runtime::renderResponse
mhsdesign 95169a6
WIP: Hacky HttpResponseConstraints
mhsdesign d567bdc
WIP: Hurray make Runtime independent of ControllerContext
mhsdesign 1aeaa49
WIP: Migrate PluginImplementation to use `unsafeHttpResponseConstrains`
mhsdesign b9128fb
WIP: FusionObject to not depend on the controller context
mhsdesign c3d3681
WIP: Skip non working test :(
mhsdesign 6ae0b24
TASK: Migrate further fusion objects to `$this->runtime->fusionGlobal…
mhsdesign 6298673
Revert introduction of `HttpResponseConstraints` and api in runtime t…
mhsdesign cc70fed
TASK: Migrate further fusion objects to `$this->runtime->fusionGlobal…
mhsdesign 58cefd6
TASK: Document legacy Runtime::getControllerContext
mhsdesign 7559f87
TASK: Extract controller context legacy layer into withSimulatedLegac…
mhsdesign 35f688d
TASK: Runtime fix `renderResponse` lock not being released
mhsdesign 8adfc90
TASK: Runtime `renderResponse` unwrap `RuntimeException` itself
mhsdesign 05aefc7
TASK: Add Fusion RuntimeException::getWrappedException
mhsdesign 706ccc7
TASK: Remove manual http response parsing from FusionExceptionView
mhsdesign aca97ab
TASK: Revert Fusion `FusionView` HttpResponse support
mhsdesign 8a53df6
TASK: Make Fusion `FusionView` independent of `ControllerContext`
mhsdesign c0ddd45
!!! TASK: Introduce `LegacyFusionControllerContext` instead of using …
mhsdesign 64c1a41
TASK: Fix passing `tags` to plugin
mhsdesign 35d06fb
!!! BUGFIX: Fusions `FusionView` will return `ResponseInterface` inst…
mhsdesign a24805e
TASK: `FusionExceptionView` handles psr response correctly
mhsdesign 9450f74
TASK: `Runtime::renderResponse` will try to jsonSerialize result if n…
mhsdesign 2e79a6d
TASK: Improve `fusionGlobals` handling in the Fusion `FusionView`
mhsdesign 4184042
TASK: Runtime remove magic fusion jsonSerialize again
mhsdesign 3f4089a
TASK: Refine fusion inline docs
mhsdesign 51fb7f7
TASK: Adjust views to stricter return types
mhsdesign e1a2678
TASK: Return `ResponseInterface` or `StreamInterface` in fusion view
mhsdesign a99de6c
TASK: Adjust to strict types in `ViewInterface`
mhsdesign 716e6a8
Fix typos
mhsdesign 2cf100f
TASK: Introduce `TestingViewForFusionRuntime` for testing instead of …
mhsdesign File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
9 changes: 9 additions & 0 deletions
9
Neos.Fusion/Classes/Core/IllegalEntryFusionPathValueException.php
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Neos\Fusion\Core; | ||
|
|
||
| final class IllegalEntryFusionPathValueException extends \Neos\Fusion\Exception | ||
| { | ||
| } |
127 changes: 127 additions & 0 deletions
127
Neos.Fusion/Classes/Core/LegacyFusionControllerContext.php
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Neos\Fusion\Core; | ||
|
|
||
| use Neos\Flow\Annotations as Flow; | ||
| use Neos\Flow\Mvc\ActionRequest; | ||
| use Neos\Flow\Mvc\ActionResponse; | ||
| use Neos\Flow\Mvc\Controller\ControllerContext; | ||
| use Neos\Flow\Mvc\FlashMessage\FlashMessageContainer; | ||
| use Neos\Flow\Mvc\FlashMessage\FlashMessageService; | ||
| use Neos\Flow\Mvc\Routing\UriBuilder; | ||
|
|
||
| /** | ||
| * Legacy stub to replace the original {@see ControllerContext} inside Fusion {@see Runtime::getControllerContext()}. | ||
| * | ||
| * The concept of the controller context inside Fusion has been deprecated. | ||
| * | ||
| * You should definitely not pass this object along further, which will also most likely not work as it doesn't | ||
| * satisfy the constraint of `instanceof ControllerContext`! | ||
| * | ||
| * To migrate the use case of fetching the active request, please look into {@see FusionGlobals::get()} instead. | ||
| * By convention, an {@see ActionRequest} will be available as `request`: | ||
| * | ||
| * $actionRequest = $this->runtime->fusionGlobals->get('request'); | ||
| * if (!$actionRequest instanceof ActionRequest) { | ||
| * // fallback or error | ||
| * } | ||
| * | ||
| * To get an {@see UriBuilder} proceed with: | ||
| * | ||
| * $uriBuilder = new UriBuilder(); | ||
| * $uriBuilder->setRequest($actionRequest); | ||
| * | ||
| * WARNING regarding {@see Runtime::getControllerContext()}: | ||
| * Invoking this backwards-compatible layer is possibly unsafe, if the rendering was not started | ||
| * in {@see self::renderResponse()} or no `request` global is available. This will raise an exception. | ||
| * | ||
| * @deprecated with Neos 9.0 can be removed with 10 | ||
| * @internal | ||
| */ | ||
| final class LegacyFusionControllerContext | ||
| { | ||
| /** | ||
| * @Flow\Inject | ||
| * @var FlashMessageService | ||
| */ | ||
| protected $flashMessageService; | ||
|
|
||
| public function __construct( | ||
| private readonly ActionRequest $request, | ||
| private readonly ActionResponse $legacyActionResponseForCurrentRendering | ||
| ) { | ||
| } | ||
|
|
||
| /** | ||
| * To migrate the use case of fetching the active request, please look into {@see FusionGlobals::get()} instead. | ||
| * By convention, an {@see ActionRequest} will be available as `request`: | ||
| * | ||
| * $actionRequest = $this->runtime->fusionGlobals->get('request'); | ||
| * if (!$actionRequest instanceof ActionRequest) { | ||
| * // fallback or error | ||
| * } | ||
| * | ||
| * @deprecated with Neos 9.0 can be removed with 10 | ||
| */ | ||
| public function getRequest(): ActionRequest | ||
| { | ||
| return $this->request; | ||
| } | ||
|
|
||
| /** | ||
| * To migrate the use case of getting the UriBuilder please use this instead: | ||
| * | ||
| * $actionRequest = $this->runtime->fusionGlobals->get('request'); | ||
| * if (!$actionRequest instanceof ActionRequest) { | ||
| * // fallback or error | ||
| * } | ||
| * $uriBuilder = new UriBuilder(); | ||
| * $uriBuilder->setRequest($actionRequest); | ||
| * | ||
| * @deprecated with Neos 9.0 can be removed with 10 | ||
| */ | ||
| public function getUriBuilder(): UriBuilder | ||
| { | ||
| $uriBuilder = new UriBuilder(); | ||
| $uriBuilder->setRequest($this->request); | ||
| return $uriBuilder; | ||
| } | ||
|
|
||
| /** | ||
| * To migrate this use case please use {@see FlashMessageService::getFlashMessageContainerForRequest()} in | ||
| * combination with fetching the active request as described here {@see getRequest} instead. | ||
| * | ||
| * @deprecated with Neos 9.0 can be removed with 10 | ||
| */ | ||
| public function getFlashMessageContainer(): FlashMessageContainer | ||
| { | ||
| return $this->flashMessageService->getFlashMessageContainerForRequest($this->request); | ||
| } | ||
|
|
||
| /** | ||
| * PURELY INTERNAL with partially undefined behaviour!!! | ||
| * | ||
| * Gives access to the legacy mutable action response simulation {@see Runtime::withSimulatedLegacyControllerContext()} | ||
| * | ||
| * Initially it was possible to mutate the current response of the active MVC controller through this getter. | ||
| * | ||
| * While *HIGHLY* internal behaviour and *ONLY* to be used by Neos.Fusion.Form or Neos.Neos:Plugin | ||
| * this legacy layer is in place to still allow this functionality. | ||
| * | ||
| * @deprecated with Neos 9.0 can be removed with 10 | ||
| * @internal THIS SHOULD NEVER BE CALLED ON USER-LAND | ||
| */ | ||
| public function getResponse(): ActionResponse | ||
| { | ||
| // expose action response to be possibly mutated in neos forms or fusion plugins. | ||
| // this behaviour is highly internal and deprecated! | ||
| return $this->legacyActionResponseForCurrentRendering; | ||
| } | ||
|
|
||
| /** | ||
| * The method {@see ControllerContext::getArguments()} was removed without replacement. | ||
| */ | ||
| // public function getArguments(): Arguments; | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.