src/AtechNet/CoreBundle/Entity/BillingoComment.php line 20

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;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. /**
  11.  * BillingoComment
  12.  *
  13.  * @Table(name="billingo_comment")
  14.  * @Entity
  15.  * @HasLifecycleCallbacks
  16.  */
  17. class BillingoComment extends AbstractSignedEntity
  18. {
  19.     /**
  20.      * @var CustomerBillingoData
  21.      *
  22.      * @Assert\NotNull
  23.      *
  24.      * @ManyToOne(targetEntity="CustomerBillingoData", inversedBy="comments")
  25.      * @JoinColumn(name="document_id", referencedColumnName="id")
  26.      */
  27.     private $document;
  28.     /**
  29.      * @var string
  30.      *
  31.      * @Column(name="text", type="text", nullable=true)
  32.      */
  33.     private $text;
  34.     /**
  35.      * @param User $user
  36.      * @return bool
  37.      */
  38.     public function isCreatedByUser(User $user): bool
  39.     {
  40.         return !is_null($this->getCreatedBy()) && $this->getCreatedBy()->getId() == $user->getId();
  41.     }
  42.     
  43.     /**
  44.      * @return CustomerBillingoData
  45.      */
  46.     public function getDocument(): CustomerBillingoData
  47.     {
  48.         return $this->document;
  49.     }
  50.     /**
  51.      * @param CustomerBillingoData $document
  52.      */
  53.     public function setDocument(CustomerBillingoData $document): void
  54.     {
  55.         $this->document = $document;
  56.     }
  57.     /**
  58.      * @return string
  59.      */
  60.     public function getText(): string
  61.     {
  62.         return $this->text;
  63.     }
  64.     /**
  65.      * @param string $text
  66.      */
  67.     public function setText(string $text)
  68.     {
  69.         $this->text = $text;
  70.     }
  71. }