add subject variable to expression context

This commit is contained in:
Christian Flothmann 2015-11-30 11:54:38 +01:00
parent 729b98c2ad
commit 346943e2f5
2 changed files with 4 additions and 0 deletions

View File

@ -448,6 +448,9 @@ FrameworkBundle
Security
--------
* The `object` variable passed to expressions evaluated by the `ExpressionVoter`
is deprecated. Instead use the new `subject` variable.
* The `AbstractVoter` class was deprecated. Instead, extend the `Voter` class and
move your voting logic in the `supports($attribute, $subject)` and
`voteOnAttribute($attribute, $object, TokenInterface $token)` methods.

View File

@ -102,6 +102,7 @@ class ExpressionVoter implements VoterInterface
'token' => $token,
'user' => $token->getUser(),
'object' => $object,
'subject' => $object,
'roles' => array_map(function ($role) { return $role->getRole(); }, $roles),
'trust_resolver' => $this->trustResolver,
);