From cb8ba0067c22c628c8a2607b7ad9fcc4c2019d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Fri, 29 Oct 2021 18:29:18 +0200 Subject: [PATCH] Add documentation about CacheableVoterInterface --- security/voters.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/security/voters.rst b/security/voters.rst index d860886f175..aec93cff3a6 100644 --- a/security/voters.rst +++ b/security/voters.rst @@ -62,6 +62,18 @@ which makes creating a voter even easier:: .. _how-to-use-the-voter-in-a-controller: +.. tip:: + + Checking each voter several times can be time consumming for applications + that perform a lot of permission checks. However, when a voter implements + the :class:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\CacheableVoterInterface`, + the access decision manager, will remember the attribute and type of subject + supported by the voter, and will, next, only call the involved voters. + + .. versionadded:: 5.4 + + The ``CacheableVoterInterface`` interface was introduced in Symfony 5.4. + Setup: Checking for Access in a Controller ------------------------------------------