Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5f5f4aa

Browse filesBrowse files
committed
minor #17507 Update UPGRADE-3.0 with correct Voter details (jbafford)
This PR was merged into the 2.8 branch. Discussion ---------- Update UPGRADE-3.0 with correct Voter details | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | n/a | Fixed tickets | | License | MIT | Doc PR | AbstractVoter was removed, but the upgrade instructions to use Voter were not complete and continued to reference AbstractVoter. Commits ------- 7b2a538 Update UPGRADE-3.0 with correct Voter details
2 parents 5d3d913 + 7b2a538 commit 5f5f4aa
Copy full SHA for 5f5f4aa

File tree

Expand file treeCollapse file tree

1 file changed

+16
-9
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-9
lines changed

‎UPGRADE-3.0.md

Copy file name to clipboardExpand all lines: UPGRADE-3.0.md
+16-9Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -898,11 +898,6 @@ UPGRADE FROM 2.x to 3.0
898898

899899
### Security
900900

901-
* The `AbstractVoter` class was removed in favor of the new `Voter` class.
902-
903-
* The `VoterInterface::supportsClass` and `supportsAttribute` methods were
904-
removed from the interface.
905-
906901
* The `Resources/` directory was moved to `Core/Resources/`
907902

908903
* The `key` settings of `anonymous`, `remember_me` and `http_digest` are
@@ -994,8 +989,15 @@ UPGRADE FROM 2.x to 3.0
994989
));
995990
```
996991

997-
* The `AbstractVoter::getSupportedAttributes()` and `AbstractVoter::getSupportedClasses()`
998-
methods have been removed in favor of `AbstractVoter::supports()`.
992+
* The `AbstractVoter` class was removed. Instead, extend the new `Voter` class,
993+
introduced in 2.8, and move your voting logic to the to the `supports($attribute, $subject)`
994+
and `voteOnAttribute($attribute, $object, TokenInterface $token)` methods.
995+
996+
* The `vote()` method from the `VoterInterface` was changed to now accept arbitrary
997+
types, and not only objects.
998+
999+
* The `supportsClass` and `supportsAttribute` methods were
1000+
removed from the `VoterInterface` interface.
9991001

10001002
Before:
10011003

@@ -1019,14 +1021,19 @@ UPGRADE FROM 2.x to 3.0
10191021
After:
10201022

10211023
```php
1022-
class MyVoter extends AbstractVoter
1024+
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
1025+
1026+
class MyVoter extends Voter
10231027
{
10241028
protected function supports($attribute, $object)
10251029
{
10261030
return $object instanceof Post && in_array($attribute, array('CREATE', 'EDIT'));
10271031
}
10281032
1029-
// ...
1033+
protected function voteOnAttribute($attribute, $object, TokenInterface $token)
1034+
{
1035+
// Return true or false
1036+
}
10301037
}
10311038
```
10321039

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.