src/Entity/Common/Confirmation.php line 13
<?php
namespace App\Entity\Common;
use App\Entity\Olympiad\Online\Participant;
use App\Entity\Traits\CreatedTrait;
use App\Entity\Traits\UpdatedTrait;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'confirmations')]
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
class Confirmation
{
use CreatedTrait;
use UpdatedTrait;
public const SEND_TIMEOUT = 60 * 1;
public const VALIDATION_TIMEOUT = 60 * 60;
public const TYPE_EMAIL = 'email';
public const TYPE_PHONE = 'phone';
#[ORM\Id]
#[ORM\Column(type: 'string', length: 36)]
private string $uuid;
#[ORM\Column(type: 'string', length: 36, nullable: false)]
private string $object_uuid;
#[ORM\Column(type: 'string')]
private string $type;
#[ORM\Column(type: 'string')]
private string $value;
#[ORM\Column(type: 'string')]
private string $code;
/**
* @var string|null
*/
#[ORM\Column(type: 'string', nullable: true)]
private ?string $ip;
/**
* @var \DateTime
*/
#[ORM\Column(type: 'datetime')]
private \DateTime $sentAt;
#[ORM\Column(type: 'boolean')]
private bool $confirmed = false;
/**
* @return string
*/
public function getType(): string
{
return $this->type;
}
/**
* @param string $type
*/
public function setType(string $type): void
{
$this->type = $type;
}
/**
* @return string
*/
public function getValue(): string
{
return $this->value;
}
/**
* @param string $value
*/
public function setValue(string $value): void
{
$this->value = $value;
}
/**
* @return string
*/
public function getCode(): string
{
return $this->code;
}
/**
* @param string $code
*/
public function setCode(string $code): void
{
$this->code = $code;
}
/**
* @return \DateTime
*/
public function getSentAt(): \DateTime
{
return $this->sentAt;
}
/**
* @param \DateTime $sentAt
*/
public function setSentAt(\DateTime $sentAt): void
{
$this->sentAt = $sentAt;
}
/**
* @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 getUuid(): string
{
return $this->uuid;
}
/**
* @param string $uuid
*/
public function setUuid(string $uuid): void
{
$this->uuid = $uuid;
}
/**
* @return string|null
*/
public function getIp(): ?string
{
return $this->ip;
}
/**
* @param string|null $ip
*/
public function setIp(?string $ip): void
{
$this->ip = $ip;
}
public function getValidTill(): \DateTime
{
$dateTime = clone($this->getSentAt());
return $dateTime->add(new \DateInterval(sprintf('PT%dS', self::VALIDATION_TIMEOUT)));
}
public function getNextSendTime(): \DateTime
{
$dateTime = clone($this->getSentAt());
return $dateTime->add(new \DateInterval(sprintf('PT%dS', self::SEND_TIMEOUT)));
}
/**
* @return string
*/
public function getObjectUuid(): string
{
return $this->object_uuid;
}
/**
* @param string $object_uuid
*/
public function setObjectUuid(string $object_uuid): void
{
$this->object_uuid = $object_uuid;
}
}