src/Admin/Modules/OnlineService/Entity/OnlineServiceCreatorCategory.php line 15

  1. <?php
  2. namespace App\Admin\Modules\OnlineService\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Admin\Modules\Contract\Entity\ContractTemplate;
  8. /**
  9.  * @ORM\Table(name="online_service_creator_category")
  10.  * @ORM\Entity
  11.  */
  12. class OnlineServiceCreatorCategory
  13. {
  14.     /**
  15.      * @ORM\Column(type="integer")
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue(strategy="AUTO")
  18.      */
  19.     private $id;
  20.     
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity="App\Admin\Modules\OnlineService\Entity\OnlineServiceCreator", inversedBy="categories")
  23.      * @ORM\JoinColumns({
  24.      *   @ORM\JoinColumn(name="id_online_service_creator", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  25.      * })
  26.      */
  27.     private $creator;
  28.     /**
  29.      * @ORM\Column(name="name", type="string", length=255, nullable=false)
  30.      */
  31.     private $name;   
  32.     
  33.     /**
  34.      * @ORM\Column(name="description", type="string", length=2048, nullable=true)
  35.      */
  36.     private $description;
  37.     
  38.     /**
  39.      * @ORM\Column(name="base_price", type="decimal", precision=14, scale=2, nullable=true)
  40.      */
  41.     private $basePrice;
  42.     
  43.     /**
  44.      * @ORM\ManyToOne(targetEntity="App\Admin\Modules\Contract\Entity\ContractTemplate")
  45.      * @ORM\JoinColumns({
  46.      *   @ORM\JoinColumn(name="id_contract_template", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  47.      * })
  48.      */
  49.     private $contractTemplate;
  50.     /**
  51.      * @ORM\OneToMany(targetEntity="App\Admin\Modules\OnlineService\Entity\OnlineServiceCreatorCategoryItem", mappedBy="category", cascade={"persist"}, orphanRemoval=true)
  52.      * @ORM\OrderBy({"id"="ASC"})
  53.      **/
  54.     private $items;    
  55.     public function __construct()
  56.     {
  57.         $this->priceListItems = new ArrayCollection();
  58.         $this->items = new ArrayCollection();
  59.     }
  60.     public function getId(): ?int
  61.     {
  62.         return $this->id;
  63.     }
  64.     public function getName(): ?string
  65.     {
  66.         return $this->name;
  67.     }
  68.     public function setName(string $name): self
  69.     {
  70.         $this->name $name;
  71.         return $this;
  72.     }
  73.     public function getDescription(): ?string
  74.     {
  75.         return $this->description;
  76.     }
  77.     public function setDescription(?string $description): self
  78.     {
  79.         $this->description $description;
  80.         return $this;
  81.     }
  82.     public function getBasePrice(): ?string
  83.     {
  84.         return $this->basePrice;
  85.     }
  86.     public function setBasePrice(?string $basePrice): self
  87.     {
  88.         $this->basePrice $basePrice;
  89.         return $this;
  90.     }
  91.     public function getCreator(): ?OnlineServiceCreator
  92.     {
  93.         return $this->creator;
  94.     }
  95.     public function setCreator(?OnlineServiceCreator $creator): self
  96.     {
  97.         $this->creator $creator;
  98.         return $this;
  99.     }
  100.     /**
  101.      * @return Collection<int, OnlineServiceCreatorCategoryItem>
  102.      */
  103.     public function getItems(): Collection
  104.     {
  105.         return $this->items;
  106.     }
  107.     public function addItem(OnlineServiceCreatorCategoryItem $item): self
  108.     {
  109.         if (!$this->items->contains($item)) {
  110.             $this->items->add($item);
  111.             $item->setCategory($this);
  112.         }
  113.         return $this;
  114.     }
  115.     public function removeItem(OnlineServiceCreatorCategoryItem $item): self
  116.     {
  117.         if ($this->items->removeElement($item)) {
  118.             // set the owning side to null (unless already changed)
  119.             if ($item->getCategory() === $this) {
  120.                 $item->setCategory(null);
  121.             }
  122.         }
  123.         return $this;
  124.     }
  125.     public function getContractTemplate(): ?ContractTemplate
  126.     {
  127.         return $this->contractTemplate;
  128.     }
  129.     public function setContractTemplate(?ContractTemplate $contractTemplate): self
  130.     {
  131.         $this->contractTemplate $contractTemplate;
  132.         return $this;
  133.     }
  134. }