src/Entity/ActivityConfiguration.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ActivityConfigurationRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassActivityConfigurationRepository::class)]
  7. class ActivityConfiguration
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\ManyToOne(inversedBy'activityConfigurations')]
  14.     #[ORM\JoinColumn(nullablefalse)]
  15.     private ?Activity $activity null;
  16.     #[ORM\ManyToOne(inversedBy'activityConfigurations')]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private ?Season $season null;
  19.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  20.     private ?array $pointsConfig null;
  21.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  22.     private ?array $validationConfig null;
  23.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  24.     private ?array $evidenceConfig null;
  25.     #[ORM\Column]
  26.     private ?bool $isEnabled true;
  27.     #[ORM\Column(length50)]
  28.     private ?string $validationMethod 'automatic';
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getActivity(): ?Activity
  34.     {
  35.         return $this->activity;
  36.     }
  37.     public function setActivity(?Activity $activity): static
  38.     {
  39.         $this->activity $activity;
  40.         return $this;
  41.     }
  42.     public function getSeason(): ?Season
  43.     {
  44.         return $this->season;
  45.     }
  46.     public function setSeason(?Season $season): static
  47.     {
  48.         $this->season $season;
  49.         return $this;
  50.     }
  51.     public function getPointsConfig(): ?array
  52.     {
  53.         return $this->pointsConfig;
  54.     }
  55.     public function setPointsConfig(?array $pointsConfig): static
  56.     {
  57.         $this->pointsConfig $pointsConfig;
  58.         return $this;
  59.     }
  60.     public function getValidationConfig(): ?array
  61.     {
  62.         return $this->validationConfig;
  63.     }
  64.     public function setValidationConfig(?array $validationConfig): static
  65.     {
  66.         $this->validationConfig $validationConfig;
  67.         return $this;
  68.     }
  69.     public function getEvidenceConfig(): ?array
  70.     {
  71.         return $this->evidenceConfig;
  72.     }
  73.     public function setEvidenceConfig(?array $evidenceConfig): static
  74.     {
  75.         $this->evidenceConfig $evidenceConfig;
  76.         return $this;
  77.     }
  78.     public function isIsEnabled(): ?bool
  79.     {
  80.         return $this->isEnabled;
  81.     }
  82.     public function setIsEnabled(bool $isEnabled): static
  83.     {
  84.         $this->isEnabled $isEnabled;
  85.         return $this;
  86.     }
  87.     public function getValidationMethod(): ?string
  88.     {
  89.         return $this->validationMethod;
  90.     }
  91.     public function setValidationMethod(string $validationMethod): static
  92.     {
  93.         $this->validationMethod $validationMethod;
  94.         return $this;
  95.     }
  96.     /**
  97.      * Get the points for this activity in this season
  98.      */
  99.     public function getPoints(): ?int
  100.     {
  101.         if ($this->pointsConfig && isset($this->pointsConfig['basePoints'])) {
  102.             return $this->pointsConfig['basePoints'];
  103.         }
  104.         
  105.         return $this->activity $this->activity->getPoints() : 0;
  106.     }
  107.     /**
  108.      * Check if this activity is enabled for this season
  109.      */
  110.     public function isEnabled(): bool
  111.     {
  112.         return $this->isEnabled;
  113.     }
  114.     /**
  115.      * Get the maximum submissions per period for this activity in this season
  116.      */
  117.     public function getMaxPerPeriod(): ?int
  118.     {
  119.         if ($this->pointsConfig && isset($this->pointsConfig['maxPerPeriod'])) {
  120.             return $this->pointsConfig['maxPerPeriod'];
  121.         }
  122.         
  123.         return $this->activity $this->activity->getMaxPerPeriod() : 0;
  124.     }
  125.     /**
  126.      * Check if evidence is required for this activity in this season
  127.      */
  128.     public function isEvidenceRequired(): bool
  129.     {
  130.         if ($this->evidenceConfig && isset($this->evidenceConfig['required'])) {
  131.             return $this->evidenceConfig['required'];
  132.         }
  133.         
  134.         return $this->activity $this->activity->isEvidenceRequired() : false;
  135.     }
  136. }