src/Entity/Carrier/Carrier.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Carrier;
  3. use App\Entity\ProduitCarrier;
  4. use App\Repository\CarrierRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  9. use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
  10. use App\Entity\Order\Order;
  11. #[ORM\Entity(repositoryClassCarrierRepository::class)]
  12. class Carrier implements TranslatableInterface
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $name null;
  20.     #[ORM\Column(nullabletrue)]
  21.     private ?bool $isEnable null;
  22.     use TranslatableTrait;
  23.     #[Assert\Valid]
  24.     protected $translations;
  25.     #[ORM\OneToMany(mappedBy'carrier'targetEntityProduitCarrier::class)]
  26.     private Collection $produitCarriers;
  27.     #[ORM\Column(length255nullabletrue)]
  28.     private ?string $country null;
  29.     #[ORM\OneToMany(mappedBy'carrier'targetEntityOrder::class)]
  30.     private Collection $orders;
  31.     #[ORM\Column(nullabletrue)]
  32.     private ?bool $disableCheck null;
  33.     #[ORM\Column]
  34.     private ?bool $isFree null;
  35.     public function __construct()
  36.     {
  37.         $this->produitCarriers = new ArrayCollection();
  38.         $this->orders = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getName(): ?string
  45.     {
  46.         return $this->name;
  47.     }
  48.     public function setName(?string $name): static
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function isIsEnable(): ?bool
  54.     {
  55.         return $this->isEnable;
  56.     }
  57.     public function setIsEnable(?bool $isEnable): static
  58.     {
  59.         $this->isEnable $isEnable;
  60.         return $this;
  61.     }
  62.     /**
  63.      * @return Collection<int, ProduitCarrier>
  64.      */
  65.     public function getProduitCarriers(): Collection
  66.     {
  67.         return $this->produitCarriers;
  68.     }
  69.     public function addProduitCarrier(ProduitCarrier $produitCarrier): static
  70.     {
  71.         if (!$this->produitCarriers->contains($produitCarrier)) {
  72.             $this->produitCarriers->add($produitCarrier);
  73.             $produitCarrier->setCarrier($this);
  74.         }
  75.         return $this;
  76.     }
  77.     public function removeProduitCarrier(ProduitCarrier $produitCarrier): static
  78.     {
  79.         if ($this->produitCarriers->removeElement($produitCarrier)) {
  80.             // set the owning side to null (unless already changed)
  81.             if ($produitCarrier->getCarrier() === $this) {
  82.                 $produitCarrier->setCarrier(null);
  83.             }
  84.         }
  85.         return $this;
  86.     }
  87.     public function getCountry(): ?string
  88.     {
  89.         return $this->country;
  90.     }
  91.     public function setCountry(?string $country): static
  92.     {
  93.         $this->country $country;
  94.         return $this;
  95.     }
  96.      /**
  97.      * @return Collection<int, Order>
  98.      */
  99.     public function getOrders(): Collection
  100.     {
  101.         return $this->orders;
  102.     }
  103.     public function addOrder(Order $order): static
  104.     {
  105.         if (!$this->orders->contains($order)) {
  106.             $this->orders->add($order);
  107.             $order->setCarrier($this);
  108.         }
  109.         return $this;
  110.     }
  111.     public function removeOrder(Order $order): static
  112.     {
  113.         if ($this->orders->removeElement($order)) {
  114.             // set the owning side to null (unless already changed)
  115.             if ($order->getCarrier() === $this) {
  116.                 $order->setCarrier(null);
  117.             }
  118.         }
  119.         return $this;
  120.     }
  121.     public function __toString(){
  122.         return $this->getName();
  123.     }
  124.     public function getDisableCheck(): ?bool
  125.     {
  126.         return $this->disableCheck;
  127.     }
  128.     public function setDisableCheck(?bool $disableCheck): static
  129.     {
  130.         $this->disableCheck $disableCheck;
  131.         return $this;
  132.     }
  133.     public function isIsFree(): ?bool
  134.     {
  135.         return $this->isFree;
  136.     }
  137.     public function setIsFree(bool $isFree): static
  138.     {
  139.         $this->isFree $isFree;
  140.         return $this;
  141.     }
  142. }