Closed mhsdesign closed 1 month ago
I would drop argumentsToBeExcludedFromQueryString
for now.
We could make the queryString manipulation for addQuerystring
be a part of the fusion implementation instead of passing this down? ala fusion lets the router create an Uri and then just appends a given query string (DataStructure?) to this Uri object? that would be trivial to implement and removes the feature from routing.
I think were talking slightly past each other. addQueryString
is a boolean flag:
:addQueryString: (boolean) Whether to keep the query parameters of the current URI :argumentsToBeExcludedFromQueryString: (array) Query parameters to exclude for
addQueryString
That means its yes is separate from the routing - currently handled by Flows uri builder - but might still not be sensible to reimplement.
The flow uribuilder code is obscured due to the nature of subrequests but its current implementation looks like this: https://github.com/neos/flow-development-collection/blob/32055e5c966579509a3ec06a3520b246696bcdc4/Neos.Flow/Classes/Mvc/Routing/UriBuilder.php#L452:
protected function mergeArgumentsWithRequestArguments(array $arguments)
{
// ... (sub-request stuff) ...
if ($this->request->isMainRequest() && $this->addQueryString === true) {
$requestArguments = $this->request->getArguments();
foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) {
unset($requestArguments[$argumentToBeExcluded]);
}
if ($requestArguments !== []) {
$arguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $arguments);
}
}
return $arguments;
}
That means to archive the same feature without these little helpers, one could write this in Fusion:
- root = Neos.Fusion:NodeUri {
- addQueryString = true
- argumentsToBeExcludedFromQueryString = ${['bar']}
- }
+ root = Neos.Fusion:NodeUri {
+ additionalParams = ${request.arguments.filter((value, key) => key != 'bar')}
+ }
Alternatively with a proper introduction of queryParameters
as option for fusion that will use the new UriHelper::uriWithAdditionalQueryParameters
(https://github.com/neos/flow-development-collection/pull/3316) one could even use queryParameters
directly instead of the to be deprecated additionalParams
that leverage append exceeding arguments internally. Basically we definitely want #3914 for 9.0. (Or maybe for even back-ported for 8.x)
As it seems to be easier than assumed to offer a b/c layer in Fusion, where we still have the action request at hand, i could reimplement it for 9.0
Right yeah the bool is meh it can go I guess
Actually i could imagine implementing it like:
$nodeUriBuilder->uriFor($nodeAddress, Options::create()->withAddedQueryString($actionRequest, excludedArguments: ['bar']);
its just an odd api, but would work and re enable the usecase for the LinkingService, NodeUri in Fusion & Fluid for Neos 9.0
But with the expense of carrying this thing around another time - till Neos 10. I think the additionalParams = ${request.arguments}
"hack" is more than enough for people really relying on this dated feature.
This should also be removed from the flow UriBuilder
As part of improving our flow routing and uri building we discussed to also adjust our fusion prototypes and the Linking service accordingly.
It was originally planned to deprecate
addQueryString
andargumentsToBeExcludedFromQueryString
for Neos 9.0:The docs state:
public discussion so far
@mficzel said:
@kitsunet noted (Dresden sprint 23):
Which was answered by @mficzel
how to move forward?
We rediscussed this topic briefly again in the HH Sprint March and we came to the conclusion that as the features are artefacts of the past (typo3) they can be safely removed with Neos 9. They should not be part of a new uri builder api and thus are not fundamentally supported.
We could think of an anti corruption layer in front but i dont know if that is possible - it looks like some effort - and for that i have to understand how the conceptional outdated and obsolete features should work. At least we thought it would not be worth the effort as there are more dedicated replacement and patterns to solve the once thought usecase.
So We need to make a final decision in order to move forward with the overhaul of the new uri builder.
When we agree to remove the features we should also write a little upgrade note.
links
Neos.Fusion:ActionUri
and deprecate said properties: https://github.com/neos/neos-development-collection/pull/3914