[Security] abstract voter implements CacheableVoterInterface

This commit is contained in:
MrYamous
2026-01-25 12:02:45 +01:00
parent d57f111f4b
commit bf30a88bf6

View File

@@ -48,6 +48,13 @@ which makes creating a voter even easier::
abstract protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool;
}
.. note::
The Voter class also implements
:class:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\CacheableVoterInterface`
whith methods used to improve
:ref:`voting performance <voter-improve-performance>` thanks to caching.
.. _how-to-use-the-voter-in-a-controller:
Setup: Checking for Access in a Controller
@@ -288,6 +295,8 @@ If you're using the :ref:`default services.yaml configuration <service-container
you're done! Symfony will automatically pass the ``security.helper``
service when instantiating your voter (thanks to autowiring).
.. _voter-improve-performance:
Improving Voter Performance
---------------------------