Skip to content

Commit

Permalink
add subject variable to expression context
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Nov 30, 2015
1 parent 729b98c commit 346943e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions UPGRADE-2.8.md
Expand Up @@ -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.
Expand Down
Expand Up @@ -102,6 +102,7 @@ private function getVariables(TokenInterface $token, $object)
'token' => $token,
'user' => $token->getUser(),
'object' => $object,
'subject' => $object,
'roles' => array_map(function ($role) { return $role->getRole(); }, $roles),
'trust_resolver' => $this->trustResolver,
);
Expand Down

0 comments on commit 346943e

Please sign in to comment.