-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI][Router][DX] Invalidate routing cache when container parameters changed #21767
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
[DI][Router][DX] Invalidate routing cache when container parameters changed #21767
Conversation
👍 Nice work! |
private $parameters; | ||
|
||
/** | ||
* @param array $parameters The container parameters values to track |
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.
I would remove "values" here.
return false; | ||
} | ||
} | ||
} catch (ParameterNotFoundException $exception) { |
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.
Why not calling hasParameter()
instead?
Thanks for the review. @xabbuh's comments addressed. |
👍 |
Thank you @ogizanagi. |
…er parameters changed (ogizanagi) This PR was merged into the 3.3-dev branch. Discussion ---------- [DI][Router][DX] Invalidate routing cache when container parameters changed | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21426 | License | MIT | Doc PR | N/A Supersedes #21443 but only for master. Indeed, this implementation uses a new feature: a `ContainerParametersResource` which compares cached containers parameters (collected at some point, here by the `Router`) with current ones in the container. On the contrary of the previous PR targeting 2.7, this will only invalidate routing cache when parameters actually used in the routes changed and will avoid always rebuilding the routing cache when the container is rebuilt, just to catch the edge case of someone modifying a parameter. Commits ------- fad4d9e [DI][Router][DX] Invalidate routing cache when container parameters changed
Supersedes #21443 but only for master.
Indeed, this implementation uses a new feature: a
ContainerParametersResource
which compares cached containers parameters (collected at some point, here by theRouter
) with current ones in the container.On the contrary of the previous PR targeting 2.7, this will only invalidate routing cache when parameters actually used in the routes changed and will avoid always rebuilding the routing cache when the container is rebuilt, just to catch the edge case of someone modifying a parameter.