| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- declare(strict_types=1);
- namespace App\Service\Cotisation;
- use App\ApiResources\Cotisation\Cotisation;
- use App\Repository\Organization\OrganizationRepository;
- /**
- * Class CotisationCreator : Service contenant les manipulations associés à la ressource Cotisation.
- */
- class CotisationCreator
- {
- public function __construct(
- private readonly OrganizationRepository $organizationRepository,
- private readonly Utils $cotisationUtils,
- ) {
- }
- public function getCotisation(int $organizationId): Cotisation
- {
- $cotisation = new Cotisation();
- $cotisation->setOrganizationId($organizationId);
- $cotisation->setCotisationYear($this->cotisationUtils->getCurrentCotisationYear());
- $organization = $this->organizationRepository->find($organizationId);
- $cotisation->setAlertState($this->cotisationUtils->getAlertState(
- $organization,
- $cotisation->getCotisationYear())
- );
- return $cotisation;
- }
- }
|