refactor(state): merge parameter and link security #7200
Merged
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.
I was working on parameters and it struck me that @KDederichs actually wrote a ParameterProvider for links that could be quite useful with all kind of parameters (not only uri variables also knowns as links, especially that a Link extends Parameter). This refactor removes a lot of code by reusing the logic of the actual parameters (that also have a security) and adding the features that were only present on Links to every parameters.
Tests left to be done:
test that the URI Variable value gets propagated in the providers(actually conflicts to much, use the $operation->getUriVariables[$key]->getValue())This mimics the behavior of the well-known
MapEntity
of symfony:After that if an Author is not found this throws a 404 (disable this using
extraProperties: ['throw_not_found' => false]
on the Link (or Parameter of any kind). ThenuriVariables['authorId']
should contain the Author from the database.This can be applied to any kind of parameters:
This also resolves #7112 in my opinion ping @joelwurtz @lyrixx