src/Entity/Quote/QuoteRequest.php line 22

  1. <?php
  2. namespace App\Entity\Quote;
  3. use App\Entity\Customer\Customer;
  4. use App\Entity\Messaging\Thread;
  5. use App\Entity\Product\Product;
  6. use App\Entity\Product\ProductMesurementUnit;
  7. use App\Entity\Taxonomy\Taxon;
  8. use App\Entity\User\ShopUser;
  9. use App\Repository\Quote\QuoteRequestRepository;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. use Doctrine\Common\Collections\Collection;
  12. use Doctrine\DBAL\Types\Types;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Sylius\Component\Resource\Model\ResourceInterface;
  15. use Symfony\Component\Validator\Constraints as Assert;
  16. #[ORM\Entity
  17. #[ORM\Table(name'app_quote_request')]
  18. class QuoteRequest  implements ResourceInterface 
  19. {
  20.     #[ORM\Id]
  21.     #[ORM\GeneratedValue]
  22.     #[ORM\Column]
  23.     private ?int $id null;
  24.     #[ORM\Column(length50)]
  25.     private ?string $marking null
  26.     #[ORM\Column]
  27.     #[Assert\NotBlank]
  28.     #[Assert\Positive
  29.     private ?int $quantity null;
  30.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  31.     private ?string $note null;
  32.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  33.     private ?\DateTimeInterface $createdAt null;
  34.     #[ORM\ManyToOne]
  35.     private ?Taxon $taxon null;
  36.     #[ORM\ManyToOne]
  37.     private ?Product $product null;
  38.     #[ORM\ManyToOne]
  39.     private ?Customer $customer null;
  40.     #[ORM\ManyToOne]
  41.     private ?ShopUser $owner null;
  42.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  43.     private ?Thread $thread null;
  44.     #[ORM\ManyToOne]
  45.     private ?ProductMesurementUnit $unit null;
  46.     #[ORM\OneToMany(mappedBy'quote'targetEntityQuoteRequestAttribute::class,cascade: ['persist''remove'], orphanRemovaltrue)]
  47.     private Collection $attributes;
  48.     #[ORM\OneToMany(mappedBy'quote'targetEntityQuoteRequestOption::class,cascade: ['persist''remove'])]
  49.     private Collection $options;
  50.     #[ORM\OneToMany(mappedBy'quote'targetEntityQuoteRequestFile::class,cascade: ['persist''remove'])]
  51.     private Collection $files;
  52.  
  53.     #[ORM\Column(length150nullabletrue)]
  54.     #[Assert\NotBlank]
  55.     #[Assert\Length(
  56.         min2,
  57.         max150,
  58.         minMessage'Your first name must be at least {{ limit }} characters long',
  59.         maxMessage'Your first name cannot be longer than {{ limit }} characters',
  60.     )]
  61.     private ?string $firstname null;
  62.     #[ORM\Column(length150nullabletrue)]
  63.     #[Assert\NotBlank]
  64.     #[Assert\Length(
  65.         min2,
  66.         max150,
  67.         minMessage'Your last name must be at least {{ limit }} characters long',
  68.         maxMessage'Your last name cannot be longer than {{ limit }} characters',
  69.     )]
  70.     private ?string $lastname null;
  71.     #[ORM\Column(length255nullabletrue)]
  72.     #[Assert\NotBlank]
  73.     #[Assert\Email(
  74.         message'The email {{ value }} is not a valid email.',
  75.     )]
  76.     private ?string $email null;
  77.     #[ORM\Column(length50nullabletrue)]
  78.     #[Assert\NotBlank]
  79.  
  80.     private ?string $phoneNumber null;
  81.     #[ORM\Column(length255)]
  82.     #[Assert\NotBlank]
  83.     #[Assert\Length(
  84.         min2,
  85.         max150,
  86.         minMessage'Company name must be at least {{ limit }} characters long',
  87.         maxMessage'Company name cannot be longer than {{ limit }} characters',
  88.     )]
  89.     private ?string $company null;
  90.     #[ORM\Column(length255nullabletrue)]
  91.  
  92.     private ?string $companyWebsite null;
  93.     #[ORM\Column(length3)]
  94.     private ?string $country null
  95.     #[ORM\Column(length255)]
  96.     #[Assert\NotBlank]
  97.     #[Assert\Length(
  98.         min2
  99.         minMessage'Company address must be at least {{ limit }} characters long'
  100.     )]
  101.     private ?string $companyAddress null;
  102.     #[ORM\Column(length255nullabletrue)]
  103.     private ?string $dimensions null;
  104.     #[ORM\Column(nullabletrue)]
  105.     private ?bool $sample null;
  106.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  107.     private ?\DateTimeInterface $updatedAt null;
  108.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  109.     private ?\DateTimeImmutable $deletedAt null;
  110.     #[ORM\Column(length30nullabletrue)]
  111.     private ?string $code null;
  112.     #[ORM\Column(length30nullabletrue)]
  113.     private ?string $type null;
  114.     #[ORM\OneToMany(mappedBy'quote'targetEntityQuoteRequestWorkflowTransition::class, cascade: ['persist''remove'])]
  115.     private Collection $transitions;
  116.     public function __construct()
  117.     {
  118.         $this->attributes = new ArrayCollection();
  119.         $this->options = new ArrayCollection();
  120.         $this->files = new ArrayCollection();
  121.         $this->marking 'opened';
  122.         $this->createdAt = new \Datetime();
  123.         $this->updatedAt = new \Datetime();
  124.         $this->transitions = new ArrayCollection();
  125.     }
  126.     public function getId(): ?int
  127.     {
  128.         return $this->id;
  129.     }
  130.     public function getMarking(): ?string
  131.     {
  132.         return $this->marking;
  133.     }
  134.     public function setMarking(string $marking): self
  135.     {
  136.         $this->marking $marking;
  137.         return $this;
  138.     } 
  139.     
  140.     public function getQuantity(): ?int
  141.     {
  142.         return $this->quantity;
  143.     }
  144.     public function setQuantity(int $quantity): self
  145.     {
  146.         $this->quantity $quantity;
  147.         return $this;
  148.     }
  149.     public function getNote(): ?string
  150.     {
  151.         return $this->note;
  152.     }
  153.     public function setNote(?string $note): self
  154.     {
  155.         $this->note $note;
  156.         return $this;
  157.     }
  158.     public function getCreatedAt(): ?\DateTimeInterface
  159.     {
  160.         return $this->createdAt;
  161.     }
  162.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  163.     {
  164.         $this->createdAt $createdAt;
  165.         return $this;
  166.     }
  167.     public function getTaxon(): ?Taxon
  168.     {
  169.         return $this->taxon;
  170.     }
  171.     public function setTaxon(?Taxon $taxon): self
  172.     {
  173.         $this->taxon $taxon;
  174.         return $this;
  175.     }
  176.     public function getProduct(): ?Product
  177.     {
  178.         return $this->product;
  179.     }
  180.     public function setProduct(?Product $product): self
  181.     {
  182.         $this->product $product;
  183.         return $this;
  184.     }
  185.     public function getCustomer(): ?Customer
  186.     {
  187.         return $this->customer;
  188.     }
  189.     public function setCustomer(?Customer $customer): self
  190.     {
  191.         $this->customer $customer;
  192.         return $this;
  193.     }
  194.     public function getOwner(): ?ShopUser
  195.     {
  196.         return $this->owner;
  197.     }
  198.     public function setOwner(?ShopUser $owner): self
  199.     {
  200.         $this->owner $owner;
  201.         return $this;
  202.     }
  203.     public function getThread(): ?Thread
  204.     {
  205.         return $this->thread;
  206.     }
  207.     public function setThread(?Thread $thread): self
  208.     {
  209.         $this->thread $thread;
  210.         return $this;
  211.     }
  212.     public function getUnit(): ?ProductMesurementUnit
  213.     {
  214.         return $this->unit;
  215.     }
  216.     public function setUnit(?ProductMesurementUnit $unit): self
  217.     {
  218.         $this->unit $unit;
  219.         return $this;
  220.     }
  221.     /**
  222.      * @return Collection<int, QuoteRequestAttribute>
  223.      */
  224.     public function getAttributes(): Collection
  225.     {
  226.         return $this->attributes;
  227.     }
  228.     public function addAttribute(QuoteRequestAttribute $attribute): self
  229.     {
  230.         if (!$this->attributes->contains($attribute)) {
  231.             $this->attributes->add($attribute);
  232.             $attribute->setQuote($this);
  233.         }
  234.         return $this;
  235.     }
  236.     public function removeAttribute(QuoteRequestAttribute $attribute): self
  237.     {
  238.         if ($this->attributes->removeElement($attribute)) {
  239.             // set the owning side to null (unless already changed)
  240.             if ($attribute->getQuote() === $this) {
  241.                 $attribute->setQuote(null);
  242.             }
  243.         }
  244.         return $this;
  245.     }
  246.     /**
  247.      * @return Collection<int, QuoteRequestOption>
  248.      */
  249.     public function getOptions(): Collection
  250.     {
  251.         return $this->options;
  252.     }
  253.     public function addOption(QuoteRequestOption $option): self
  254.     {
  255.         if (!$this->options->contains($option)) {
  256.             $this->options->add($option);
  257.             $option->setQuote($this);
  258.         }
  259.         return $this;
  260.     }
  261.     public function removeOption(QuoteRequestOption $option): self
  262.     {
  263.         if ($this->options->removeElement($option)) {
  264.             // set the owning side to null (unless already changed)
  265.             if ($option->getQuote() === $this) {
  266.                 $option->setQuote(null);
  267.             }
  268.         }
  269.         return $this;
  270.     }
  271.     /**
  272.      * @return Collection<int, QuoteRequestFile>
  273.      */
  274.     public function getFiles(): Collection
  275.     {
  276.         return $this->files;
  277.     }
  278.     public function addFile(QuoteRequestFile $file): self
  279.     {
  280.         if (!$this->files->contains($file)) {
  281.             $this->files->add($file);
  282.             $file->setQuote($this);
  283.         }
  284.         return $this;
  285.     }
  286.     public function removeFile(QuoteRequestFile $file): self
  287.     {
  288.         if ($this->files->removeElement($file)) {
  289.             // set the owning side to null (unless already changed)
  290.             if ($file->getQuote() === $this) {
  291.                 $file->setQuote(null);
  292.             }
  293.         }
  294.         return $this;
  295.     }
  296.  
  297.     public function getFirstname(): ?string
  298.     {
  299.         return $this->firstname;
  300.     }
  301.     public function setFirstname(?string $firstname): self
  302.     {
  303.         $this->firstname $firstname;
  304.         return $this;
  305.     }
  306.     public function getLastname(): ?string
  307.     {
  308.         return $this->lastname;
  309.     }
  310.     public function setLastname(?string $lastname): self
  311.     {
  312.         $this->lastname $lastname;
  313.         return $this;
  314.     }
  315.     public function getEmail(): ?string
  316.     {
  317.         return $this->email;
  318.     }
  319.     public function setEmail(?string $email): self
  320.     {
  321.         $this->email $email;
  322.         return $this;
  323.     }
  324.     public function getPhoneNumber(): ?string
  325.     {
  326.         return $this->phoneNumber;
  327.     }
  328.     public function setPhoneNumber(?string $phoneNumber): self
  329.     {
  330.         $this->phoneNumber $phoneNumber;
  331.         return $this;
  332.     }
  333.     public function getCompany(): ?string
  334.     {
  335.         return $this->company;
  336.     }
  337.     public function setCompany(string $company): self
  338.     {
  339.         $this->company $company;
  340.         return $this;
  341.     }
  342.     public function getCompanyWebsite(): ?string
  343.     {
  344.         return $this->companyWebsite;
  345.     }
  346.     public function setCompanyWebsite(?string $companyWebsite): self
  347.     {
  348.         $this->companyWebsite $companyWebsite;
  349.         return $this;
  350.     }
  351.     public function getCountry(): ?string
  352.     {
  353.         return $this->country;
  354.     }
  355.     public function setCountry(string $country): self
  356.     {
  357.         $this->country $country;
  358.         return $this;
  359.     }
  360.  
  361.     public function getCompanyAddress(): ?string
  362.     {
  363.         return $this->companyAddress;
  364.     }
  365.     public function setCompanyAddress(string $companyAddress): self
  366.     {
  367.         $this->companyAddress $companyAddress;
  368.         return $this;
  369.     }
  370.     public function getDimensions(): ?string
  371.     {
  372.         return $this->dimensions;
  373.     }
  374.     public function setDimensions(?string $dimensions): self
  375.     {
  376.         $this->dimensions $dimensions;
  377.         return $this;
  378.     }
  379.     public function isSample(): ?bool
  380.     {
  381.         return $this->sample;
  382.     }
  383.     public function setSample(?bool $sample): self
  384.     {
  385.         $this->sample $sample;
  386.         return $this;
  387.     }
  388.     public function getUpdatedAt(): ?\DateTimeInterface
  389.     {
  390.         return $this->updatedAt;
  391.     }
  392.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  393.     {
  394.         $this->updatedAt $updatedAt;
  395.         return $this;
  396.     }
  397.     public function getDeletedAt(): ?\DateTimeImmutable
  398.     {
  399.         return $this->deletedAt;
  400.     }
  401.     public function setDeletedAt(?\DateTimeImmutable $deletedAt): self
  402.     {
  403.         $this->deletedAt $deletedAt;
  404.         return $this;
  405.     }
  406.     public function getCode(): ?string
  407.     {
  408.         return $this->code;
  409.     }
  410.     public function setCode(?string $code): self
  411.     {
  412.         $this->code $code;
  413.         return $this;
  414.     }
  415.     public function getType(): ?string
  416.     {
  417.         return $this->type;
  418.     }
  419.     public function setType(?string $type): self
  420.     {
  421.         $this->type $type;
  422.         return $this;
  423.     }
  424.     /**
  425.      * @return Collection<int, QuoteRequestWorkflowTransition>
  426.      */
  427.     public function getTransitions(): Collection
  428.     {
  429.         return $this->transitions;
  430.     }
  431.     public function addTransition(QuoteRequestWorkflowTransition $transition): self
  432.     {
  433.         if (!$this->transitions->contains($transition)) {
  434.             $this->transitions->add($transition);
  435.             $transition->setQuote($this);
  436.         }
  437.         return $this;
  438.     }
  439.     public function removeTransition(QuoteRequestWorkflowTransition $transition): self
  440.     {
  441.         if ($this->transitions->removeElement($transition)) {
  442.             // set the owning side to null (unless already changed)
  443.             if ($transition->getQuote() === $this) {
  444.                 $transition->setQuote(null);
  445.             }
  446.         }
  447.         return $this;
  448.     }
  449. }