src/Entity/Delivery.php line 243

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DeliveryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use JsonSerializable;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=DeliveryRepository::class)
  10.  */
  11. class Delivery implements JsonSerializable
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $name;
  23.     /**
  24.      * @ORM\Column(type="text", nullable=true)
  25.      */
  26.     private $address;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=true)
  29.      */
  30.     private $phone;
  31.     /**
  32.      * @ORM\Column(type="string", length=255, nullable=true)
  33.      */
  34.     private $tva;
  35.     /**
  36.      * @ORM\Column(type="float")
  37.      */
  38.     private $price;
  39.     /**
  40.      * @ORM\Column(type="float")
  41.      */
  42.     private $totalPrice;
  43.     /**
  44.      * @ORM\OneToMany(targetEntity=Document::class, mappedBy="delivery")
  45.      */
  46.     private $documents;
  47.     /**
  48.      * @ORM\Column(type="boolean", nullable=true)
  49.      */
  50.     private $isSelected;
  51.     /**
  52.     * @ORM\Column(type="string", length=255)
  53.     */
  54.     private $type;
  55.     
  56.     /**
  57.      * @ORM\Column(type="datetime", nullable=true)
  58.      */
  59.     private $deletedAt;
  60.     /**
  61.      * @ORM\Column(type="float", nullable=true)
  62.      */
  63.     private $returnPrice;
  64.     /**
  65.      * @ORM\Column(type="text", nullable=true)
  66.      */
  67.     private $note;
  68.     /**
  69.      * @ORM\Column(type="boolean", nullable=true)
  70.      */
  71.     private $isActive;
  72.      /**
  73.      * @ORM\Column(type="string", length=255, nullable=true)
  74.      */   
  75.     private ?string $logo null;    
  76.    
  77.     public function __construct()
  78.     {
  79.         $this->documents = new ArrayCollection();
  80.     }
  81.     public function getReturnPrice(): ?float
  82.     {
  83.         return $this->returnPrice;
  84.     }
  85.     public function setReturnPrice(?float $returnPrice): self
  86.     {
  87.         $this->returnPrice $returnPrice;
  88.         return $this;
  89.     }
  90.    
  91.     public function getLogo(): ?string 
  92.     
  93.         return $this->logo
  94.     }
  95.     public function setLogo(?string $logo): self 
  96.     
  97.         $this->logo $logo; return $this
  98.     }
  99.     public function getNote(): ?string
  100.     {
  101.         return $this->note;
  102.     }
  103.     public function setNote(?string $note): self
  104.     {
  105.         $this->note $note;
  106.         return $this;
  107.     }
  108.     public function getisActive(): ?bool
  109.     {
  110.         return $this->isActive;
  111.     }
  112.     public function setisActive(?bool $isActive): self
  113.     {
  114.         $this->isActive $isActive;
  115.         return $this;
  116.     }
  117.     
  118.     public function getId(): ?int
  119.     {
  120.         return $this->id;
  121.     }
  122.     public function getName(): ?string
  123.     {
  124.         return $this->name;
  125.     }
  126.     public function setName(string $name): self
  127.     {
  128.         $this->name $name;
  129.         return $this;
  130.     }
  131.     public function getPrice(): ?float
  132.     {
  133.         return $this->price;
  134.     }
  135.     public function setPrice(float $price): self
  136.     {
  137.         $this->price $price;
  138.         return $this;
  139.     }
  140.     public function getTotalPrice(): ?float
  141.     {
  142.         return $this->totalPrice;
  143.     }
  144.     public function setTotalPrice(float $totalPrice): self
  145.     {
  146.         $this->totalPrice $totalPrice;
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection|Document[]
  151.      */
  152.     public function getDocuments(): Collection
  153.     {
  154.         return $this->documents;
  155.     }
  156.     public function addDocument(Document $document): self
  157.     {
  158.         if( !$this->documents->contains($document)) {
  159.             $this->documents[] = $document;
  160.             $document->setDelivery($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeDocument(Document $document): self
  165.     {
  166.         if( $this->documents->removeElement($document)) {
  167.             // set the owning side to null (unless already changed)
  168.             if( $document->getDelivery() === $this) {
  169.                 $document->setDelivery(null);
  170.             }
  171.         }
  172.         return $this;
  173.     }
  174.     public function getIsSelected(): ?bool
  175.     {
  176.         return $this->isSelected;
  177.     }
  178.     public function setIsSelected(?bool $isSelected): self
  179.     {
  180.         $this->isSelected $isSelected;
  181.         return $this;
  182.     }
  183.     public function getType(): ?string
  184.     {
  185.         return $this->type;
  186.     }
  187.     public function setType(string $type): self
  188.     {
  189.         $this->type $type;
  190.         return $this;
  191.     }
  192.     public function getDeletedAt(): ?\DateTimeInterface
  193.     {
  194.         return $this->deletedAt;
  195.     }
  196.     public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  197.     {
  198.         $this->deletedAt $deletedAt;
  199.         return $this;
  200.     }
  201.     public function jsonSerialize()
  202.     {
  203.         return array(
  204.             'id' => $this->getId(),
  205.             'name' => $this->getName(),
  206.             'price' => $this->getPrice(),
  207.             'amountFreeDelivery' => isset($_ENV['FREE_DELIVERY_AMOUNT']) ? floatval($_ENV['FREE_DELIVERY_AMOUNT']) : 0// Minimum de commande pour avoir une livraison gratuite
  208.         );
  209.     }
  210.     public function setAddress(string $address): self
  211.     {
  212.         $this->address $address;
  213.         return $this;
  214.     }
  215.     public function getAddress(): ?string
  216.     {
  217.         return $this->address;
  218.     }
  219.     public function setPhone(string $phone): self
  220.     {
  221.         $this->phone $phone;
  222.         return $this;
  223.     }
  224.     public function getPhone(): ?string
  225.     {
  226.         return $this->phone;
  227.     }
  228.     public function setTva(string $tva): self
  229.     {
  230.         $this->tva $tva;
  231.         return $this;
  232.     }
  233.     public function getTva(): ?string
  234.     {
  235.         return $this->tva;
  236.     }
  237. }