<?php
namespace App\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
use EightMarq\CoreComponent\Entity\BaseEntity;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Table(name="monthly_test_plans", uniqueConstraints={
* @UniqueConstraint(columns={"date", "deleted_at"})
* })
*
* @UniqueEntity(fields={"date"}, errorPath="date", message="error.monthly_test_plan.duplicaiton")
*
* @ORM\Entity()
*
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=true, hardDelete=false)
*/
class MonthlyTestPlan extends BaseEntity
{
/**
* @var DateTime | null
*
* @ORM\Column(type="datetime")
*
*
* @Assert\NotBlank()
*/
protected $date;
/**
* @var int | null
*
* @ORM\Column(type="integer")
*
*
* @Assert\NotBlank()
* @Assert\GreaterThanOrEqual(0)
*/
protected $value;
public function __toString()
{
return $this->getDate() ? $this->getDate()->format('Y-m') : '';
}
/**
* @return DateTime|null
*/
public function getDate(): ?DateTime
{
return $this->date;
}
/**
* @param DateTime|null $date
*/
public function setDate(?DateTime $date): void
{
$this->date = $date;
}
/**
* @return int|null
*/
public function getValue(): ?int
{
return $this->value;
}
/**
* @param int|null $value
*/
public function setValue(?int $value): void
{
$this->value = $value;
}
}