src/Entity/Olympiad/Online/Category.php line 22

  1. <?php
  2. namespace App\Entity\Olympiad\Online;
  3. use App\Entity\Common\DateInterval;
  4. use App\Entity\Common\DateTimeInterval;
  5. use App\Entity\Common\TimeInterval;
  6. use App\Entity\Traits\ActiveTrait;
  7. use App\Entity\Traits\TrackerFields;
  8. use App\Entity\Traits\UserCreatedInterface;
  9. use App\Entity\Traits\UserUpdatedInterface;
  10. use App\Entity\Traits\WeightTrait;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  15. use App\Model\Translation\TranslatableTrait;
  16. #[ORM\Table(name'olymp_online_category')]
  17. #[ORM\Entity(repositoryClass'App\Repository\Olympiad\Online\CategoryRepository')]
  18. #[ORM\HasLifecycleCallbacks]
  19. class Category implements UserCreatedInterfaceUserUpdatedInterfaceTranslatableInterface
  20. {
  21.     use TrackerFields;
  22.     use WeightTrait;
  23.     use ActiveTrait;
  24.     use TranslatableTrait;
  25.     #[ORM\Id]
  26.     #[ORM\GeneratedValue(strategy'AUTO')]
  27.     #[ORM\Column(type'integer')]
  28.     private $id;
  29.     #[ORM\Column(type'string'nullabletrue)]
  30.     private $caption;
  31.     /**
  32.      * @var string|null
  33.      */
  34.     #[ORM\Column(type'string'nullabletrue)]
  35.     private ?string $apply_button null;
  36.     /**
  37.      * @var string|null
  38.      */
  39.     #[ORM\Column(type'string'nullabletrue)]
  40.     private ?string $forceLocale null;
  41.     #[ORM\Column(type'boolean'options: ['default' => true])]
  42.     private bool $registration_enable true;
  43.     /**
  44.      * @var DateTimeInterval
  45.      */
  46.     #[ORM\Embedded(class: 'App\Entity\Common\DateTimeInterval'columnPrefix'ro_')]
  47.     private DateTimeInterval $registration_open;
  48.     #[ORM\ManyToOne(targetEntity'App\Entity\Olympiad\Online\Event'inversedBy'categories')]
  49.     #[ORM\JoinColumn(nullablefalse)]
  50.     private Event $event;
  51.     /**
  52.      * @var DateInterval
  53.      */
  54.     #[ORM\Embedded(class: 'App\Entity\Common\DateInterval'columnPrefix'di_')]
  55.     private DateInterval $interval;
  56.     /**
  57.      * @var TimeInterval
  58.      */
  59.     #[ORM\Embedded(class: 'App\Entity\Common\TimeInterval'columnPrefix'ti_')]
  60.     private TimeInterval $timeInterval;
  61.     /**
  62.      * @var Collection
  63.      */
  64.     #[ORM\OneToMany(targetEntity'App\Entity\Olympiad\Online\Direction'mappedBy'category')]
  65.     private Collection $directions;
  66.     /**
  67.      * @var string|null
  68.      */
  69.     #[ORM\Column(type'text'nullabletrue)]
  70.     private ?string $apply_description null;
  71.     /**
  72.      * @var array
  73.      */
  74.     #[ORM\Column(type'json'nullabletrue)]
  75.     private ?array $participantTypes = [Participant::TYPE_SCHOOLParticipant::TYPE_STUDENT];
  76.     /**
  77.      * @var array
  78.      */
  79.     #[ORM\Column(type'json'nullabletrue)]
  80.     private ?array $countries = [];
  81.     /**
  82.      * @var array
  83.      */
  84.     #[ORM\Column(type'json'nullabletrue)]
  85.     private ?array $federal_districts = [];
  86.     #[ORM\OneToMany(targetEntity'App\Entity\Olympiad\Online\CourseOverride'mappedBy'category')]
  87.     private Collection $courseOverrides;
  88.     public function __construct()
  89.     {
  90.         $this->interval = new DateInterval();
  91.         $this->registration_open = new DateTimeInterval();
  92.         $this->timeInterval = new TimeInterval();
  93.         $this->courseOverrides = new ArrayCollection();
  94.     }
  95.     /**
  96.      * @return mixed
  97.      */
  98.     public function getId()
  99.     {
  100.         return $this->id;
  101.     }
  102.     /**
  103.      * @param mixed $id
  104.      */
  105.     public function setId($id): void
  106.     {
  107.         $this->id $id;
  108.     }
  109.     /**
  110.      * @return mixed
  111.      */
  112. //    public function getCaption()
  113. //    {
  114. //        return $this->translate()->getCaption();
  115. //    }
  116.     /**
  117.      * @return DateTimeInterval
  118.      */
  119.     public function getRegistrationOpen(): DateTimeInterval
  120.     {
  121.         return $this->registration_open;
  122.     }
  123.     /**
  124.      * @param DateTimeInterval $registration_open
  125.      */
  126.     public function setRegistrationOpen(DateTimeInterval $registration_open): void
  127.     {
  128.         $this->registration_open $registration_open;
  129.     }
  130.     /**
  131.      * @return Event
  132.      */
  133.     public function getEvent(): Event
  134.     {
  135.         return $this->event;
  136.     }
  137.     /**
  138.      * @param Event $event
  139.      */
  140.     public function setEvent(Event $event): void
  141.     {
  142.         $this->event $event;
  143.     }
  144.     /**
  145.      * @return DateInterval
  146.      */
  147.     public function getInterval(): DateInterval
  148.     {
  149.         return $this->interval;
  150.     }
  151.     /**
  152.      * @param DateInterval $interval
  153.      */
  154.     public function setInterval(DateInterval $interval): void
  155.     {
  156.         $this->interval $interval;
  157.     }
  158.     /**
  159.      * @return TimeInterval
  160.      */
  161.     public function getTimeInterval(): TimeInterval
  162.     {
  163.         return $this->timeInterval;
  164.     }
  165.     /**
  166.      * @param TimeInterval $timeInterval
  167.      */
  168.     public function setTimeInterval(TimeInterval $timeInterval): void
  169.     {
  170.         $this->timeInterval $timeInterval;
  171.     }
  172.     /**
  173.      * @return Collection<Direction>
  174.      */
  175.     public function getDirections(): Collection
  176.     {
  177.         return $this->directions;
  178.     }
  179.     /**
  180.      * @param Collection $directions
  181.      */
  182.     public function setDirections(Collection $directions): void
  183.     {
  184.         $this->directions $directions;
  185.     }
  186.     /**
  187.      * @return array
  188.      */
  189.     public function getParticipantTypes(): ?array
  190.     {
  191.         return $this->participantTypes;
  192.     }
  193.     /**
  194.      * @param array $participantTypes
  195.      */
  196.     public function setParticipantTypes(?array $participantTypes): void
  197.     {
  198.         $this->participantTypes $participantTypes;
  199.     }
  200.     /**
  201.      * @return array
  202.      */
  203.     public function getCountries(): ?array
  204.     {
  205.         return $this->countries;
  206.     }
  207.     /**
  208.      * @param array $countries
  209.      */
  210.     public function setCountries(?array $countries): void
  211.     {
  212.         $this->countries $countries;
  213.     }
  214.     /**
  215.      * @return array
  216.      */
  217.     public function getFederalDistricts(): ?array
  218.     {
  219.         return $this->federal_districts;
  220.     }
  221.     /**
  222.      * @param array $federal_districts
  223.      */
  224.     public function setFederalDistricts(?array $federal_districts): void
  225.     {
  226.         $this->federal_districts $federal_districts;
  227.     }
  228.     /**
  229.      * @return string|null
  230.      */
  231.     public function getForceLocale(): ?string
  232.     {
  233.         return $this->forceLocale;
  234.     }
  235.     /**
  236.      * @param string|null $forceLocale
  237.      */
  238.     public function setForceLocale(?string $forceLocale): void
  239.     {
  240.         $this->forceLocale $forceLocale;
  241.     }
  242.     /**
  243.      * @return bool
  244.      */
  245.     public function isRegistrationEnable(): bool
  246.     {
  247.         return $this->registration_enable;
  248.     }
  249.     /**
  250.      * @param bool $registration_enable
  251.      */
  252.     public function setRegistrationEnable(bool $registration_enable): void
  253.     {
  254.         $this->registration_enable $registration_enable;
  255.     }
  256. }