src/Security/Api/Authorization/Voter/Cmr/EmploymentValidationVoter.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Security\Api\Authorization\Voter\Cmr;
  3. use App\Security\Api\Authorization\Voter\AbstractCrudValidationVoter;
  4. use App\Security\Api\Authorization\VoterAttribute\Cmr\CaseEntityVoterAttribute;
  5. use App\Security\Api\Authorization\VoterAttribute\Cmr\EmploymentVoterAttribute;
  6. use App\Validator\Api\Data\Cmr\EmploymentDataValidator;
  7. /**
  8.  * Validation voter.
  9.  *
  10.  * @package API
  11.  * @author fmt.hodzic
  12.  * @internal
  13.  */
  14. class EmploymentValidationVoter extends AbstractCrudValidationVoter
  15. {
  16.     /**
  17.      * Constructor.
  18.      *
  19.      * @param EmploymentDataValidator $validator The standard validator.
  20.      */
  21.     public function __construct(EmploymentDataValidator $validator)
  22.     {
  23.         // prevent false-positive php:S1185
  24.         $this->validator $validator;
  25.         parent::__construct($validator);
  26.     }
  27.     /**
  28.      * Returns a list of supported attributes.
  29.      *
  30.      * @return array
  31.      * @noinspection PhpClassConstantAccessedViaChildClassInspection
  32.      */
  33.     protected function getSupportedAttributes(): array
  34.     {
  35.         return [
  36.             EmploymentVoterAttribute::getAttribute(EmploymentVoterAttribute::METHOD_ID_CREATE),
  37.             EmploymentVoterAttribute::getAttribute(EmploymentVoterAttribute::METHOD_ID_DELETE),
  38.             EmploymentVoterAttribute::getAttribute(EmploymentVoterAttribute::METHOD_ID_LIST),
  39.             EmploymentVoterAttribute::getAttribute(EmploymentVoterAttribute::METHOD_ID_READ),
  40.             EmploymentVoterAttribute::getAttribute(EmploymentVoterAttribute::METHOD_ID_UPDATE),
  41.             CaseEntityVoterAttribute::getAttribute(EmploymentVoterAttribute::METHOD_ID_UPDATE_ACTIVE_STATUS),
  42.         ];
  43.     }
  44. }