src/Entity/Quote/Quote.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Quote;
  3. use App\Entity\AppUser;
  4. use App\Repository\Quote\QuoteRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=QuoteRepository::class)
  10.  */
  11. class Quote
  12. {
  13.     const STATUS_CREATED 'created';
  14.     const STATUS_APPROVED 'approved';
  15.     const STATUS_ACCEPTED 'accepted';
  16.     const STATUS_CANCELLED 'cancelled';
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="datetime_immutable")
  25.      */
  26.     private $createdAt;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=AppUser::class, inversedBy="quotes")
  29.      * @ORM\JoinColumn(nullable=false)
  30.      */
  31.     private $createdBy;
  32.     /**
  33.      * @ORM\OneToMany(targetEntity=QuoteService::class, mappedBy="quote")
  34.      */
  35.     private $services;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=Client::class, inversedBy="quotes")
  38.      * @ORM\JoinColumn(nullable=false)
  39.      */
  40.     private $client;
  41.     /**
  42.      * @ORM\Column(type="string", length=255)
  43.      */
  44.     private $status;
  45.     /**
  46.      * @ORM\Column(type="text")
  47.      */
  48.     private $content;
  49.     /**
  50.      * @ORM\Column(type="text", nullable=true)
  51.      */
  52.     private $emailContent;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity=Log::class, mappedBy="quote")
  55.      */
  56.     private $logs;
  57.     public function __construct()
  58.     {
  59.         $this->services = new ArrayCollection();
  60.         $this->logs = new ArrayCollection();
  61.     }
  62.     public function getId(): ?int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function getCreatedAt(): ?\DateTimeImmutable
  67.     {
  68.         return $this->createdAt;
  69.     }
  70.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  71.     {
  72.         $this->createdAt $createdAt;
  73.         return $this;
  74.     }
  75.     public function getCreatedBy(): ?AppUser
  76.     {
  77.         return $this->createdBy;
  78.     }
  79.     public function setCreatedBy(?AppUser $createdBy): self
  80.     {
  81.         $this->createdBy $createdBy;
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return Collection<int, QuoteService>
  86.      */
  87.     public function getServices(): Collection
  88.     {
  89.         return $this->services;
  90.     }
  91.     public function addService(QuoteService $service): self
  92.     {
  93.         if (!$this->services->contains($service)) {
  94.             $this->services[] = $service;
  95.             $service->setQuote($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeService(QuoteService $service): self
  100.     {
  101.         if ($this->services->removeElement($service)) {
  102.             // set the owning side to null (unless already changed)
  103.             if ($service->getQuote() === $this) {
  104.                 $service->setQuote(null);
  105.             }
  106.         }
  107.         return $this;
  108.     }
  109.     public function getClient(): ?Client
  110.     {
  111.         return $this->client;
  112.     }
  113.     public function setClient(?Client $client): self
  114.     {
  115.         $this->client $client;
  116.         return $this;
  117.     }
  118.     public function getStatus(): ?string
  119.     {
  120.         return $this->status;
  121.     }
  122.     public function setStatus(string $status): self
  123.     {
  124.         $this->status $status;
  125.         return $this;
  126.     }
  127.     public function getContent(): ?string
  128.     {
  129.         return $this->content;
  130.     }
  131.     public function setContent(string $content): self
  132.     {
  133.         $this->content $content;
  134.         return $this;
  135.     }
  136.     public function getEmailContent(): ?string
  137.     {
  138.         return $this->emailContent;
  139.     }
  140.     public function setEmailContent(?string $emailContent): self
  141.     {
  142.         $this->emailContent $emailContent;
  143.         return $this;
  144.     }
  145.     /**
  146.      * @return Collection<int, Log>
  147.      */
  148.     public function getLogs(): Collection
  149.     {
  150.         return $this->logs;
  151.     }
  152.     public function addLog(Log $log): self
  153.     {
  154.         if (!$this->logs->contains($log)) {
  155.             $this->logs[] = $log;
  156.             $log->setQuote($this);
  157.         }
  158.         return $this;
  159.     }
  160.     public function removeLog(Log $log): self
  161.     {
  162.         if ($this->logs->removeElement($log)) {
  163.             // set the owning side to null (unless already changed)
  164.             if ($log->getQuote() === $this) {
  165.                 $log->setQuote(null);
  166.             }
  167.         }
  168.         return $this;
  169.     }
  170. }