voter = $voterFactory ->generate(self::class) ->addCheckFor(Center::class, [self::STATS, self::LISTS, self::DUPLICATE]) ->addCheckFor(Person::class, [self::CREATE, self::UPDATE, self::SEE, self::DUPLICATE]) ->addCheckFor(null, [self::CREATE]) ->build(); } public function getRoles(): array { return $this->getAttributes(); } public function getRolesWithHierarchy(): array { return ['Person' => $this->getRoles()]; } public function getRolesWithoutScope(): array { return $this->getAttributes(); } protected function supports($attribute, $subject) { return $this->voter->supports($attribute, $subject); } protected function voteOnAttribute($attribute, $subject, TokenInterface $token) { return $this->voter->voteOnAttribute($attribute, $subject, $token); } private function getAttributes() { return [self::CREATE, self::UPDATE, self::SEE, self::STATS, self::LISTS, self::DUPLICATE]; } }