src/Entity/CRM/ProductServices.php line 11

  1. <?php
  2. namespace App\Entity\CRM;
  3. use App\Repository\ProductServicesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassProductServicesRepository::class)]
  8. class ProductServices
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $name null;
  16.     #[ORM\Column]
  17.     private bool $isActive true;
  18.     #[ORM\Column]
  19.     private float $administrationFee 0;
  20.     #[ORM\ManyToMany(targetEntityProduct::class, mappedBy'productServices')]
  21.     private Collection $products;
  22.     #[ORM\OneToMany(mappedBy'productService'targetEntityOrderProduct::class)]
  23.     private Collection $orderProducts;
  24.     #[ORM\Column]
  25.     private bool $implementation false;
  26.     public function __construct()
  27.     {
  28.         $this->products = new ArrayCollection();
  29.         $this->orderProducts = new ArrayCollection();
  30.     }
  31.     public function __toString(): string
  32.     {
  33.         return $this->name ?? '';
  34.     }
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getName(): ?string
  40.     {
  41.         return $this->name;
  42.     }
  43.     public function setName(string $name): static
  44.     {
  45.         $this->name $name;
  46.         return $this;
  47.     }
  48.     public function isIsActive(): bool
  49.     {
  50.         return $this->isActive;
  51.     }
  52.     public function setIsActive(bool $isActive): static
  53.     {
  54.         $this->isActive $isActive;
  55.         return $this;
  56.     }
  57.     public function getAdministrationFee(): float
  58.     {
  59.         return $this->administrationFee;
  60.     }
  61.     public function setAdministrationFee(float $administrationFee): static
  62.     {
  63.         $this->administrationFee $administrationFee;
  64.         return $this;
  65.     }
  66.     /**
  67.      * @return Collection<int, Product>
  68.      */
  69.     public function getProducts(): Collection
  70.     {
  71.         return $this->products;
  72.     }
  73.     public function addProduct(Product $product): static
  74.     {
  75.         if (!$this->products->contains($product)) {
  76.             $this->products->add($product);
  77.             $product->addProductService($this);
  78.         }
  79.         return $this;
  80.     }
  81.     public function removeProduct(Product $product): static
  82.     {
  83.         if ($this->products->removeElement($product)) {
  84.             $product->removeProductService($this);
  85.         }
  86.         return $this;
  87.     }
  88.     /**
  89.      * @return Collection<int, OrderProduct>
  90.      */
  91.     public function getOrderProducts(): Collection
  92.     {
  93.         return $this->orderProducts;
  94.     }
  95.     public function addOrderProduct(OrderProduct $orderProduct): static
  96.     {
  97.         if (!$this->orderProducts->contains($orderProduct)) {
  98.             $this->orderProducts->add($orderProduct);
  99.             $orderProduct->setProductService($this);
  100.         }
  101.         return $this;
  102.     }
  103.     public function removeOrderProduct(OrderProduct $orderProduct): static
  104.     {
  105.         if ($this->orderProducts->removeElement($orderProduct)) {
  106.             if ($orderProduct->getProductService() === $this) {
  107.                 $orderProduct->setProductService(null);
  108.             }
  109.         }
  110.         return $this;
  111.     }
  112.     public function isImplementation(): bool
  113.     {
  114.         return $this->implementation;
  115.     }
  116.     public function setImplementation(bool $implementation): void
  117.     {
  118.         $this->implementation $implementation;
  119.     }
  120. }