From c0b9e9950a55e668fcd5a9d0d0977baadca59d99 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 31 May 2016 21:30:07 +0200 Subject: [PATCH] document method name changes in Voter class --- UPGRADE-3.0.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 265724627c2ae..08796bd419d29 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1040,6 +1040,39 @@ UPGRADE FROM 2.x to 3.0 } ``` + * The `AbstractVoter::isGranted()` method has been replaced by `Voter::voteOnAttribute()`. + + Before: + + ```php + class MyVoter extends AbstractVoter + { + protected function isGranted($attribute, $object, $user = null) + { + return 'EDIT' === $attribute && $user === $object->getAuthor(); + } + + // ... + } + ``` + + After: + + ```php + class MyVoter extends Voter + { + protected function voteOnAttribute($attribute, $object, TokenInterface $token) + { + return 'EDIT' === $attribute && $token->getUser() === $object->getAuthor(); + } + + // ... + } + ``` + + * The `supportsAttribute()` and `supportsClass()` methods of the `AuthenticatedVoter`, `ExpressionVoter`, + and `RoleVoter` classes have been removed. + * The `intention` option was renamed to `csrf_token_id` for all the authentication listeners. * The `csrf_provider` option was renamed to `csrf_token_generator` for all the authentication listeners.