abstractclass Voter implementsVoterInterface,CacheableVoterInterface

Voter is an abstract default implementation of a voter.

Methods

int
vote(TokenInterface$token,mixed$subject,array$attributes)

Returns the vote for the given parameters.

bool
supportsAttribute(string$attribute)

Return false if your voter doesn't support the given attribute. Symfony will cache that decision and won't call your voter again for that attribute.

bool
supportsType(string$subjectType)

Return false if your voter doesn't support the given subject type. Symfony will cache that decision and won't call your voter again for that subject type.

bool
supports(string$attribute,mixed$subject)

Determines if the attribute and subject are supported by this voter.

bool
voteOnAttribute(string$attribute,mixed$subject,TokenInterface$token)

Perform a single access check operation on a given attribute, subject and token.

Details

int vote(TokenInterface$token,mixed$subject,array$attributes)

Returns the vote for the given parameters.

This method must return one of the following constants: ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN.

Parameters

TokenInterface $token
mixed $subject
array $attributes

Return Value

int

bool supportsAttribute(string$attribute)

Return false if your voter doesn't support the given attribute. Symfony will cache that decision and won't call your voter again for that attribute.

Parameters

string $attribute

Return Value

bool

bool supportsType(string$subjectType)

Return false if your voter doesn't support the given subject type. Symfony will cache that decision and won't call your voter again for that subject type.

Parameters

string $subjectType The type of the subject inferred by get_class or get_debug_type

Return Value

bool

abstractprotectedbool supports(string$attribute,mixed$subject)

Determines if the attribute and subject are supported by this voter.

Parameters

string $attribute
mixed $subject

Return Value

bool

abstractprotectedbool voteOnAttribute(string$attribute,mixed$subject,TokenInterface$token)

Perform a single access check operation on a given attribute, subject and token.

It is safe to assume that $attribute and $subject already passed the "supports()" method check.

Parameters

string $attribute
mixed $subject
TokenInterface $token

Return Value

bool