src/Entity/Olympiad/Online/Direction.php line 24
<?php
namespace App\Entity\Olympiad\Online;
use App\Entity\Common\DateInterval;
use App\Entity\Common\DateTimeInterval;
use App\Entity\Common\TimeInterval;
use App\Entity\Traits\ActiveTrait;
use App\Entity\Traits\TrackerFields;
use App\Entity\Traits\UserCreatedInterface;
use App\Entity\Traits\UserUpdatedInterface;
use App\Entity\Traits\WeightTrait;
use App\Model\Translation\TranslatableTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
#[ORM\Table(name: 'olymp_online_direction')]
#[ORM\Entity(repositoryClass: 'App\Repository\Olympiad\Online\DirectionRepository')]
#[ORM\HasLifecycleCallbacks]
class Direction implements UserCreatedInterface, UserUpdatedInterface, TranslatableInterface
{
use TrackerFields;
use WeightTrait;
use ActiveTrait;
use TranslatableTrait;
public const APPLY_BY_TEST_TIME = 1;
public const APPLY_IMPLICIT = 1 << 1;
public const APPLY_RULE_RUSSIAN = 1 << 2;
public const APPLY_RULE_REGION_CFO = 1 << 3;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\ManyToOne(targetEntity: 'App\Entity\Olympiad\Online\Event', inversedBy: 'directions')]
#[ORM\JoinColumn(nullable: false)]
private Event $event;
#[ORM\ManyToOne(targetEntity: 'App\Entity\Olympiad\Online\Category', inversedBy: 'directions')]
#[ORM\JoinColumn(nullable: false)]
private Category $category;
/**
* @var DateTimeInterval
*/
#[ORM\Embedded(class: 'App\Entity\Common\DateTimeInterval', columnPrefix: 'tt_')]
private DateTimeInterval $test_time;
/**
* @var DateTimeInterval
*/
#[ORM\Embedded(class: 'App\Entity\Common\DateTimeInterval', columnPrefix: 't_ws_')]
private DateTimeInterval $work_show;
/**
* @var DateTimeInterval
*/
#[ORM\Embedded(class: 'App\Entity\Common\DateTimeInterval', columnPrefix: 't_as_')]
private DateTimeInterval $appeal_show;
/**
* @var ArrayCollection|Collection|DirectionLanguage[]
*/
#[ORM\OneToMany(targetEntity: 'App\Entity\Olympiad\Online\DirectionLanguage', cascade: ['remove', 'persist'], mappedBy: 'direction')]
private Collection $languages;
#[ORM\Column(type: 'string', nullable: true)]
private string $caption;
#[ORM\Column(type: 'string', nullable: true)]
private ?string $description = null;
/**
* @var string|null
*/
#[ORM\Column(type: 'text', nullable: true)]
private ?string $formJs = null;
/**
* @var Collection
*/
#[ORM\OneToMany(targetEntity: 'App\Entity\Olympiad\Online\Participant', mappedBy: 'direction')]
private Collection $participants;
/**
* @var array|null
*/
#[ORM\Column(type: 'json')]
private ?array $moodle_courses = [];
#[ORM\Column(type: 'integer', nullable: true,)]
private ?int $moodle_course = null;
#[ORM\Column(type: 'integer', nullable: true,)]
private ?int $moodle_element = null;
/**
* @var int
*/
#[ORM\Column(type: 'integer', nullable: false, options: ['default' => 1])]
private int $applyAllow = self::APPLY_BY_TEST_TIME;
public function __construct()
{
$this->languages = new ArrayCollection();
// $this->fields = new ArrayCollection();
$this->participants = new ArrayCollection();
// $this->interval = new DateInterval();
// $this->registration_open = new DateTimeInterval();
$this->test_time = new DateTimeInterval();
$this->work_show = new DateTimeInterval();
$this->appeal_show = new DateTimeInterval();
// $this->timeInterval = new TimeInterval();
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
*/
public function setId(int $id): void
{
$this->id = $id;
}
/**
* @return Event
*/
public function getEvent(): Event
{
return $this->event;
}
/**
* @param Event $event
*/
public function setEvent(Event $event): void
{
$this->event = $event;
}
/**
* @return string|null
*/
public function getDescription(): ?string
{
return $this->description;
}
/**
* @param string|null $description
*/
public function setDescription(?string $description): void
{
$this->description = $description;
}
/**
* @return string|null
*/
public function getFormJs(): ?string
{
return $this->formJs;
}
/**
* @param string|null $formJs
*/
public function setFormJs(?string $formJs): void
{
$this->formJs = $formJs;
}
/**
* @return Collection
*/
public function getParticipants()
{
return $this->participants;
}
/**
* @param Collection $participants
*/
public function setParticipants($participants): void
{
$this->participants = $participants;
}
/**
* @return DateInterval
*/
// public function getInterval(): DateInterval
// {
// return $this->interval;
// }
/**
* @param DateInterval $interval
*/
// public function setInterval(DateInterval $interval): void
// {
// $this->interval = $interval;
// }
/**
* @return array
*/
public function getMoodleCourses(): array
{
if (is_null($this->moodle_courses)) {
return [];
}
return $this->moodle_courses;
}
/**
* @param array|null $moodle_courses
*/
public function setMoodleCourses(?array $moodle_courses): void
{
$this->moodle_courses = $moodle_courses;
}
/**
* @return DateTimeInterval
*/
public function getTestTime(): DateTimeInterval
{
return $this->test_time;
}
/**
* @param DateTimeInterval $test_time
*/
public function setTestTime(DateTimeInterval $test_time): void
{
$this->test_time = $test_time;
}
/**
* @return TimeInterval
*/
// public function getTimeInterval(): TimeInterval
// {
// return $this->timeInterval;
// }
/**
* @param TimeInterval $timeInterval
*/
// public function setTimeInterval(TimeInterval $timeInterval): void
// {
// $this->timeInterval = $timeInterval;
// }
/**
* @return DateTimeInterval
*/
// public function getRegistrationOpen(): DateTimeInterval
// {
// return $this->registration_open;
// }
/**
* @param DateTimeInterval $registration_open
*/
// public function setRegistrationOpen(DateTimeInterval $registration_open): void
// {
// $this->registration_open = $registration_open;
// }
/**
* @return Category
*/
public function getCategory(): Category
{
return $this->category;
}
/**
* @param Category $category
*/
public function setCategory(Category $category): void
{
$this->category = $category;
}
/**
* @return int
*/
public function getApplyAllow(): int
{
return $this->applyAllow;
}
/**
* @param int $applyAllow
*/
public function setApplyAllow(int $applyAllow): void
{
$this->applyAllow = $applyAllow;
}
/**
* @return DateTimeInterval
*/
public function getWorkShow(): DateTimeInterval
{
return $this->work_show;
}
/**
* @param DateTimeInterval $work_show
*/
public function setWorkShow(DateTimeInterval $work_show): void
{
$this->work_show = $work_show;
}
/**
* @return DateTimeInterval
*/
public function getAppealShow(): DateTimeInterval
{
return $this->appeal_show;
}
/**
* @param DateTimeInterval $appeal_show
*/
public function setAppealShow(DateTimeInterval $appeal_show): void
{
$this->appeal_show = $appeal_show;
}
/**
* @return ArrayCollection|Collection|DirectionLanguage[]
*/
public function getLanguages()
{
return $this->languages;
}
/**
* @param ArrayCollection|Collection $languages
*/
public function setLanguages($languages): void
{
$this->languages = $languages;
}
public function getCaption(){
return $this->translate()->getCaption();
}
public function getMoodleCourse(): ?int
{
return $this->moodle_course;
}
public function setMoodleCourse(?int $moodle_course): void
{
$this->moodle_course = $moodle_course;
}
public function getMoodleElement(): ?int
{
return $this->moodle_element;
}
public function setMoodleElement(?int $moodle_element): void
{
$this->moodle_element = $moodle_element;
}
}