| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- declare (strict_types=1);
- namespace App\ApiResources\Cotisation;
- use ApiPlatform\Metadata\Get;
- use ApiPlatform\Metadata\ApiResource;
- use ApiPlatform\Metadata\ApiProperty;
- use App\ApiResources\ApiResourcesInterface;
- use App\State\Provider\Cotisation\CotisationProvider;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * Classe resource qui contient les informations des cotisations de la 5.9
- *
- * Security :
- * * @see App\Security\Voter\CotisationVoter
- */
- #[ApiResource(operations: [
- new Get(
- uriTemplate: '/cotisations/{organizationId}',
- security: 'is_granted("ROLE_COTISATION", object) and object.getOrganizationId() == user.getOrganization().getId()',
- provider: CotisationProvider::class
- )
- ])]
- class Cotisation implements ApiResourcesInterface
- {
- #[ApiProperty(identifier: true)]
- private int $organizationId;
- #[Assert\Choice(callback: ['\\App\\Enum\\Cotisation\\AlertStateEnum', 'toArray'], message: 'invalid-alert-state-enum')]
- private ?string $alertState = null;
- private ?int $cotisationYear = null;
- public function getOrganizationId(): ?int
- {
- return $this->organizationId;
- }
- public function setOrganizationId(?int $organizationId): self
- {
- $this->organizationId = $organizationId;
- return $this;
- }
- public function getAlertState(): ?string
- {
- return $this->alertState;
- }
- public function setAlertState(?string $alertState): self
- {
- $this->alertState = $alertState;
- return $this;
- }
- public function getCotisationYear(): ?int
- {
- return $this->cotisationYear;
- }
- public function setCotisationYear(?int $cotisationYear): self
- {
- $this->cotisationYear = $cotisationYear;
- return $this;
- }
- }
|