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

Update UPGRADE-3.0 with correct Voter details #17507

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

Merged
merged 1 commit into from
Jan 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions 25 UPGRADE-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -898,11 +898,6 @@ UPGRADE FROM 2.x to 3.0

### Security

* The `AbstractVoter` class was removed in favor of the new `Voter` class.

* The `VoterInterface::supportsClass` and `supportsAttribute` methods were
removed from the interface.

* The `Resources/` directory was moved to `Core/Resources/`

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

* The `AbstractVoter::getSupportedAttributes()` and `AbstractVoter::getSupportedClasses()`
methods have been removed in favor of `AbstractVoter::supports()`.
* The `AbstractVoter` class was removed. Instead, extend the new `Voter` class,
introduced in 2.8, and move your voting logic to the to the `supports($attribute, $subject)`
and `voteOnAttribute($attribute, $object, TokenInterface $token)` methods.

* The `vote()` method from the `VoterInterface` was changed to now accept arbitrary
types, and not only objects.

* The `supportsClass` and `supportsAttribute` methods were
removed from the `VoterInterface` interface.

Before:

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

```php
class MyVoter extends AbstractVoter
use Symfony\Component\Security\Core\Authorization\Voter\Voter;

class MyVoter extends Voter
{
protected function supports($attribute, $object)
{
return $object instanceof Post && in_array($attribute, array('CREATE', 'EDIT'));
}

// ...
protected function voteOnAttribute($attribute, $object, TokenInterface $token)
{
// Return true or false
}
}
```

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.