src/Entity/Olympiad/Online/Participant.php line 29
<?php
namespace App\Entity\Olympiad\Online;
use App\Entity\Common\BirthCertificate;
use App\Entity\Common\Country;
use App\Entity\Common\Passport;
use App\Entity\Geo\Region;
use App\Entity\Olympiad\Online\Embeded\AdditionalInfo;
use App\Entity\Traits\CreatedTrait;
use App\Entity\Traits\UpdatedTrait;
use App\Entity\User\User;
use App\Model\Olympiad\Online\AppliableInterface;
use App\Validator\Constraints\Olympiad\ParticipantFull;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
//#[ORM\Entity(repositoryClass: "App\Repository\Olympiad\Online\ParticipantRepository")]
//#[ORM\Table(name: "olymp_online_participant")]
//#[UniqueConstraint(name: "pdc", columns: ["code", "direction_id"])]
#[ParticipantFull]
#[ORM\Table(name: 'olymp_online_participant')]
#[UniqueConstraint(name: 'pdc', columns: ['code', 'direction_id'])]
#[ORM\Entity(repositoryClass: 'App\Repository\Olympiad\Online\ParticipantRepository')]
#[ORM\HasLifecycleCallbacks]
class Participant implements AppliableInterface
{
use CreatedTrait;
use UpdatedTrait;
public const STATE_NEW = 'new';
public const STATE_SEND = 'send';
public const STATE_ACCEPTED = 'accepted';
public const STATE_DISMISSED = 'dismissed';
public const TYPE_SCHOOL = 1;
public const TYPE_STUDENT = 2;
public const PUPIL_TYPE_BACHELOR = 'bachelor';
public const PUPIL_TYPE_MASTER = 'master';
public const PUPIL_TYPE_SPECIALIST = 'specialist';
public const DOC_PASSPORT = 'passport';
public const DOC_BIRTH_CERTIFICATE = 'birth_certificate';
/**
* @var Direction
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Olympiad\Online\Direction', inversedBy: 'participants')]
#[ORM\JoinColumn(nullable: false)]
private ?Direction $direction = null;
/**
* @var Country|null
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Common\Country')]
#[ORM\JoinColumn(nullable: true)]
#[Assert\NotBlank(groups: ['full_apply', 'Default'])]
private ?Country $country = null;
/**
* @var string
*/
#[ORM\Column(type: 'string', nullable: false, options: ['default' => 'new'])]
private string $state = self::STATE_NEW;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\Column(type: 'string', nullable: true)]
private ?string $code = null;
#[ORM\Column(type: 'string', length: 36)]
private string $uuid;
#[ORM\Column(type: 'boolean')]
private bool $confirmed = false;
/**
* @var string
*/
#[ORM\Column(type: 'string')]
#[Assert\NotBlank(groups: ['full_apply', 'Default'])]
private string $firstName;
/**
* @var string|null
*
*/
#[ORM\Column(type: 'string', nullable: true)]
private ?string $middleName = null;
/**
* @var string
*/
#[ORM\Column(type: 'string')]
#[Assert\NotBlank(groups: ['full_apply', 'Default'])]
private string $lastName;
/**
* @var ?DateTime
*/
#[ORM\Column(type: 'date', nullable: true)]
#[Assert\NotBlank(groups: ['full_apply'])]
#[Assert\GreaterThan('-45 years', groups: ['Default', 'full_apply'])]
#[Assert\LessThan('-10 years', groups: ['Default', 'full_apply'])]
private ?Datetime $birthday = null;
/**
* @var string|null
*/
#[ORM\Column(type: 'string', length: 50, nullable: true)]
#[Assert\NotBlank(groups: ['russian_apply', 'russian_passport'])]
private ?string $phone = null;
/**
* @var string|null
*/
#[ORM\Column(type: 'string', length: 50, nullable: true)]
#[Assert\NotBlank(groups: ['full_apply', 'Default'])]
#[Assert\Email(groups: ['full_apply', 'Default'], mode: 'strict')]
private ?string $email = null;
#[ORM\ManyToOne(targetEntity: 'App\Entity\Geo\Region')]
#[Assert\NotBlank(groups: ['russian_apply', 'russian_passport'])]
private ?Region $region;
#[ORM\ManyToOne(targetEntity: 'App\Entity\User\User')]
private ?User $user = null;
#[ORM\Column(type: 'string', nullable: true)]
#[Assert\NotBlank(groups: ['full_apply'])]
private ?string $education;
#[ORM\Column(type: 'string', nullable: true)]
#[Assert\NotBlank(groups: ['full_apply'])]
private ?string $class;
#[ORM\Column(type: 'string', nullable: true)]
#[Assert\NotBlank(groups: ['full_apply_student'])]
private ?string $pupilLevel;
#[ORM\Column(type: 'string', nullable: true)]
private ?string $eduOrganisationType;
#[ORM\Column(type: 'string', nullable: true)]
#[Assert\NotBlank(groups: ['full_apply'])]
private ?string $eduOrganisation;
#[ORM\Embedded(class: 'App\Entity\Common\Passport', columnPrefix: 'p_')]
#[Assert\Valid(groups: ['russian_passport', 'russian_apply', 'full_apply_p', 'Default'])]
private Passport $passport;
#[ORM\Embedded(class: 'App\Entity\Common\BirthCertificate', columnPrefix: 'bc_')]
#[Assert\Valid(groups: ['full_apply_bc', 'Default'])]
private BirthCertificate $bc;
#[ORM\Column(type: 'boolean', options: ['default' => false])]
private bool $canceled = false;
/**
* @var User|null
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\User\User')]
private ?User $canceledBy = null;
/**
* @var DateTime|null
*/
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTime $canceledAt = null;
/**
* @var int|null
*/
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $moodle_user_id = null;
/**
* @var string|null
*/
#[ORM\Column(type: 'string', nullable: true)]
private ?string $moodle_user_login = null;
/**
* @var string|null
*/
#[ORM\Column(type: 'string', nullable: true)]
private ?string $moodle_user_password = null;
/**
* @var string|null
*/
#[ORM\Column(type: 'text', nullable: true)]
#[Assert\NotBlank(groups: ['full_apply', 'Default'])]
private ?string $addressRegistration = null;
/**
* @var string|null
*/
#[ORM\Column(type: 'text', nullable: true)]
#[Assert\NotBlank(groups: ['full_apply', 'Default'])]
private ?string $addressFact = null;
/**
* @var Country|null
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Common\Country')]
#[ORM\JoinColumn(nullable: true)]
#[Assert\NotBlank(groups: ['full_apply', 'Default'])]
private ?Country $countryResidence = null;
/**
* @var ?string
*/
#[ORM\Column(type: 'string', nullable: true)]
#[Assert\NotBlank(groups: ['full_apply', 'Default'])]
private ?string $cityResidence;
/**
* @var bool
*/
#[ORM\Column(type: 'boolean', nullable: false, name: 'is_test_data', options: ['default' => 0])]
private bool $test_data = false;
/**
* @var AdditionalInfo
*/
#[ORM\Embedded(class: 'App\Entity\Olympiad\Online\Embeded\AdditionalInfo', columnPrefix: 'ai_')]
private AdditionalInfo $additionalInfo;
/**
* @var bool
*/
#[ORM\Column(type: 'boolean', nullable: false, name: 'is_apply_allow', options: ['default' => 0])]
private bool $applyAllow = false;
/**
* @var string
*/
#[ORM\Column(type: 'string', nullable: true, options: ['default' => 'passport'])]
#[Assert\NotBlank(groups: ['full_apply', 'Default'])]
private string $docType = self::DOC_PASSPORT;
#[ORM\ManyToOne(targetEntity: 'App\Entity\Olympiad\Online\Language')]
#[ORM\JoinColumn(nullable: true, referencedColumnName: 'locale', name: 'test_lang')]
private ?Language $test_lang = null;
/**
* @var CourseOverride|null
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Olympiad\Online\CourseOverride', inversedBy: 'participants')]
#[ORM\JoinColumn(nullable: true)]
private ?CourseOverride $courseOverride = null;
public function __construct()
{
$this->passport = new Passport();
$this->bc = new BirthCertificate();
$this->additionalInfo = new AdditionalInfo();
}
/**
* @return int
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param int $id
*/
public function setId(int $id): void
{
$this->id = $id;
}
/**
* @return string
*/
public function getUuid(): string
{
return $this->uuid;
}
/**
* @param string $uuid
*/
public function setUuid(string $uuid): void
{
$this->uuid = $uuid;
}
/**
* @return bool
*/
public function isConfirmed(): bool
{
return $this->confirmed;
}
/**
* @param bool $confirmed
*/
public function setConfirmed(bool $confirmed): void
{
$this->confirmed = $confirmed;
}
/**
* @return string
*/
public function getFirstName(): string
{
return $this->firstName;
}
/**
* @param string $firstName
*/
public function setFirstName(string $firstName): void
{
$this->firstName = $firstName;
}
/**
* @return string|null
*/
public function getMiddleName(): ?string
{
return $this->middleName;
}
/**
* @param string|null $middleName
*/
public function setMiddleName(?string $middleName): void
{
$this->middleName = $middleName;
}
/**
* @return string
*/
public function getLastName(): string
{
return $this->lastName;
}
/**
* @param string $lastName
*/
public function setLastName(string $lastName): void
{
$this->lastName = $lastName;
}
/**
* @return DateTime
*/
public function getBirthday(): ?Datetime
{
return $this->birthday;
}
/**
* @param DateTime|null $birthday
*/
public function setBirthday(?Datetime $birthday): void
{
$this->birthday = $birthday;
}
/**
* @return string|null
*/
public function getPhone(): ?string
{
return $this->phone;
}
/**
* @param string|null $phone
*/
public function setPhone(?string $phone): void
{
$this->phone = $phone;
}
/**
* @return string|null
*/
public function getEmail(): ?string
{
return $this->email;
}
/**
* @param string|null $email
*/
public function setEmail(?string $email): void
{
$this->email = $email;
}
/**
* @return Region|null
*/
public function getRegion(): ?Region
{
return $this->region;
}
/**
* @param Region|null $region
*/
public function setRegion(?Region $region): void
{
$this->region = $region;
}
/**
* @return string|null
*/
public function getEducation(): ?string
{
return $this->education;
}
/**
* @param string|null $education
*/
public function setEducation(?string $education): void
{
$this->education = $education;
}
/**
* @return string|null
*/
public function getClass(): ?string
{
return $this->class;
}
/**
* @param string|null $class
*/
public function setClass(?string $class): void
{
$this->class = $class;
}
/**
* @return string|null
*/
public function getEduOrganisationType(): ?string
{
return $this->eduOrganisationType;
}
/**
* @param string|null $eduOrganisationType
*/
public function setEduOrganisationType(?string $eduOrganisationType): void
{
$this->eduOrganisationType = $eduOrganisationType;
}
/**
* @return string|null
*/
public function getEduOrganisation(): ?string
{
return $this->eduOrganisation;
}
/**
* @param string|null $eduOrganisation
*/
public function setEduOrganisation(?string $eduOrganisation): void
{
$this->eduOrganisation = $eduOrganisation;
}
/**
* @return Passport
*/
public function getPassport(): Passport
{
return $this->passport;
}
/**
* @param Passport $passport
*/
public function setPassport(Passport $passport): void
{
$this->passport = $passport;
}
/**
* @return Direction
*/
public function getDirection(): ?Direction
{
return $this->direction;
}
/**
* @param Direction $direction
*/
public function setDirection(Direction $direction): void
{
$this->direction = $direction;
}
/**
* @return User
*/
public function getUser(): ?User
{
return $this->user;
}
/**
* @param User $user
*/
public function setUser(User $user): void
{
$this->user = $user;
}
/**
* @return bool
*/
public function isCanceled(): bool
{
return $this->canceled;
}
/**
* @param bool $canceled
*/
public function setCanceled(bool $canceled): void
{
$this->canceled = $canceled;
}
/**
* @return User|null
*/
public function getCanceledBy(): ?User
{
return $this->canceledBy;
}
/**
* @param User|null|UserInterface $canceledBy
*/
public function setCanceledBy(?User $canceledBy): void
{
$this->canceledBy = $canceledBy;
}
/**
* @return DateTime|null
*/
public function getCanceledAt(): ?DateTime
{
return $this->canceledAt;
}
/**
* @param DateTime|null $canceledAt
*/
public function setCanceledAt(?DateTime $canceledAt): void
{
$this->canceledAt = $canceledAt;
}
/**
* @return Country|null
*/
public function getCountry(): ?Country
{
return $this->country;
}
/**
* @param Country|null $country
*/
public function setCountry(?Country $country): void
{
$this->country = $country;
}
/**
* @return string
*/
public function getState(): string
{
return $this->state;
}
/**
* @param string $state
*/
public function setState(string $state): void
{
$this->state = $state;
}
/**
* @return int|null
*/
public function getMoodleUserId(): ?int
{
return $this->moodle_user_id;
}
/**
* @param int|null $moodle_user_id
*/
public function setMoodleUserId(?int $moodle_user_id): void
{
$this->moodle_user_id = $moodle_user_id;
}
/**
* @return string|null
*/
public function getMoodleUserLogin(): ?string
{
return $this->moodle_user_login;
}
/**
* @param string|null $moodle_user_login
*/
public function setMoodleUserLogin(?string $moodle_user_login): void
{
$this->moodle_user_login = $moodle_user_login;
}
/**
* @return string|null
*/
public function getMoodleUserPassword(): ?string
{
return $this->moodle_user_password;
}
/**
* @param string|null $moodle_user_password
*/
public function setMoodleUserPassword(?string $moodle_user_password): void
{
$this->moodle_user_password = $moodle_user_password;
}
public function getFullname(): string
{
return trim(str_replace(' ', ' ', sprintf('%s %s %s', $this->lastName, $this->firstName, $this->middleName)));
}
/**
* @return string|null
*/
public function getAddressRegistration(): ?string
{
return $this->addressRegistration;
}
/**
* @param string|null $addressRegistration
*/
public function setAddressRegistration(?string $addressRegistration): void
{
$this->addressRegistration = $addressRegistration;
}
/**
* @return string|null
*/
public function getAddressFact(): ?string
{
return $this->addressFact;
}
/**
* @param string|null $addressFact
*/
public function setAddressFact(?string $addressFact): void
{
$this->addressFact = $addressFact;
}
/**
* @return AdditionalInfo
*/
public function getAdditionalInfo(): AdditionalInfo
{
return $this->additionalInfo;
}
/**
* @param AdditionalInfo $additionalInfo
*/
public function setAdditionalInfo(AdditionalInfo $additionalInfo): void
{
$this->additionalInfo = $additionalInfo;
}
/**
* @return bool
*/
public function isApplyAllow(): bool
{
return $this->applyAllow;
}
/**
* @param bool $applyAllow
*/
public function setApplyAllow(bool $applyAllow): void
{
$this->applyAllow = $applyAllow;
}
/**
* @return string|null
*/
public function getCode(): ?string
{
return $this->code;
}
/**
* @param string|null $code
*/
public function setCode(?string $code): void
{
$this->code = $code;
}
/**
* @return string|null
*/
public function getPupilLevel(): ?string
{
return $this->pupilLevel;
}
/**
* @param string|null $pupilLevel
*/
public function setPupilLevel(?string $pupilLevel): void
{
$this->pupilLevel = $pupilLevel;
}
/**
* @return Country|null
*/
public function getCountryResidence(): ?Country
{
return $this->countryResidence;
}
/**
* @param Country|null $countryResidence
*/
public function setCountryResidence(?Country $countryResidence): void
{
$this->countryResidence = $countryResidence;
}
/**
* @return string|null
*/
public function getCityResidence(): ?string
{
return $this->cityResidence;
}
/**
* @param string|null $cityResidence
*/
public function setCityResidence(?string $cityResidence): void
{
$this->cityResidence = $cityResidence;
}
/**
* @return BirthCertificate
*/
public function getBc(): BirthCertificate
{
return $this->bc;
}
/**
* @param BirthCertificate $bc
*/
public function setBc(BirthCertificate $bc): void
{
$this->bc = $bc;
}
/**
* @return string
*/
public function getDocType(): string
{
return $this->docType;
}
/**
* @param string $docType
*/
public function setDocType(string $docType): void
{
$this->docType = $docType;
}
/**
* @return Language|null
*/
public function getTestLang(): ?Language
{
return $this->test_lang;
}
/**
* @param Language|null $test_lang
*/
public function setTestLang(?Language $test_lang): void
{
$this->test_lang = $test_lang;
}
/**
* @return CourseOverride|null
*/
public function getCourseOverride(): ?CourseOverride
{
return $this->courseOverride;
}
/**
* @param CourseOverride|null $courseOverride
*/
public function setCourseOverride(?CourseOverride $courseOverride): void
{
$this->courseOverride = $courseOverride;
}
}