add subject variable to expression context
This commit is contained in:
parent
729b98c2ad
commit
346943e2f5
@ -448,6 +448,9 @@ FrameworkBundle
|
|||||||
Security
|
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
|
* The `AbstractVoter` class was deprecated. Instead, extend the `Voter` class and
|
||||||
move your voting logic in the `supports($attribute, $subject)` and
|
move your voting logic in the `supports($attribute, $subject)` and
|
||||||
`voteOnAttribute($attribute, $object, TokenInterface $token)` methods.
|
`voteOnAttribute($attribute, $object, TokenInterface $token)` methods.
|
||||||
|
@ -102,6 +102,7 @@ class ExpressionVoter implements VoterInterface
|
|||||||
'token' => $token,
|
'token' => $token,
|
||||||
'user' => $token->getUser(),
|
'user' => $token->getUser(),
|
||||||
'object' => $object,
|
'object' => $object,
|
||||||
|
'subject' => $object,
|
||||||
'roles' => array_map(function ($role) { return $role->getRole(); }, $roles),
|
'roles' => array_map(function ($role) { return $role->getRole(); }, $roles),
|
||||||
'trust_resolver' => $this->trustResolver,
|
'trust_resolver' => $this->trustResolver,
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user