src/AtechNet/CoreBundle/Entity/ClaimComment.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\AtechNet\CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping\Column;
  4. use Doctrine\ORM\Mapping\Entity;
  5. use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
  6. use Doctrine\ORM\Mapping\JoinColumn;
  7. use Doctrine\ORM\Mapping\ManyToOne;
  8. use Doctrine\ORM\Mapping\Table as Table;
  9. /**
  10.  * ClaimComment
  11.  *
  12.  * @Table(name="claim_comments")
  13.  * @Entity()
  14.  * @HasLifecycleCallbacks
  15.  */
  16. class ClaimComment extends AbstractSignedEntity
  17. {
  18.     public const TYPE_FOR_NO_ONE = 1;
  19.     public const TYPE_FOR_SALES = 2;
  20.     public const TYPE_FOR_RMA = 3;
  21.     /**
  22.      * @var string
  23.      *
  24.      * @Column(name="text", type="text", nullable=true)
  25.      */
  26.     private $text;
  27.     /**
  28.      * @var int
  29.      *
  30.      * @Column(name="type", type="integer", nullable=true)
  31.      */
  32.     private $type;
  33.     /**
  34.      * @var Claim
  35.      *
  36.      * @ManyToOne(targetEntity="Claim", inversedBy="comments")
  37.      * @JoinColumn(name="claim_id", referencedColumnName="id", nullable=false)
  38.      */
  39.     private $claim;
  40.     /**
  41.      * @var User
  42.      *
  43.      * @ManyToOne(targetEntity="User")
  44.      * @JoinColumn(name="done_by", referencedColumnName="id", nullable=true)
  45.      */
  46.     private $doneBy;
  47.     /**
  48.      * @var \DateTime
  49.      *
  50.      * @Column(name="done_time", type="datetime", nullable=true)
  51.      */
  52.     private $doneTime;
  53.     /**
  54.      * @return string
  55.      */
  56.     public function getText()
  57.     {
  58.         return $this->text;
  59.     }
  60.     /**
  61.      * @param string $text
  62.      */
  63.     public function setText($text)
  64.     {
  65.         $this->text = $text;
  66.     }
  67.     /**
  68.      * @return Claim
  69.      */
  70.     public function getClaim()
  71.     {
  72.         return $this->claim;
  73.     }
  74.     /**
  75.      * @param Claim $claim
  76.      */
  77.     public function setClaim($claim)
  78.     {
  79.         $this->claim = $claim;
  80.     }
  81.     public function getType(): int|null
  82.     {
  83.         return $this->type;
  84.     }
  85.     public function setType(int $type): void
  86.     {
  87.         $this->type = $type;
  88.     }
  89.     public function getDoneBy(): User|null
  90.     {
  91.         return $this->doneBy;
  92.     }
  93.     public function setDoneBy(User $doneBy): void
  94.     {
  95.         $this->doneBy = $doneBy;
  96.     }
  97.     public function getDoneTime(): \DateTime|null
  98.     {
  99.         return $this->doneTime;
  100.     }
  101.     public function setDoneTime(\DateTime $doneTime): void
  102.     {
  103.         $this->doneTime = $doneTime;
  104.     }
  105.     /**
  106.      * @param User $user
  107.      * @return bool
  108.      */
  109.     public function isDeletableByUser(User $user)
  110.     {
  111.         return !is_null($this->getCreatedBy()) && $this->getCreatedBy()->getId() == $user->getId();
  112.     }
  113.     public function isDone()
  114.     {
  115.         return $this->doneTime != null;
  116.     }
  117. }