src/Entity/Product.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassProductRepository::class)]
  8. class Product
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255nullabletrue)]
  15.     private $name;
  16.     #[ORM\Column(type'string'length255nullabletrue)]
  17.     private $category;
  18.     #[ORM\Column(type'text'nullabletrue)]
  19.     private $description;
  20.     #[ORM\Column(type'float'nullabletrue)]
  21.     private $price;
  22.     #[ORM\Column(type'string'length255nullabletrue)]
  23.     private $glCode;
  24.     #[ORM\OneToMany(mappedBy'product'targetEntityProductPercentageSplit::class, cascade:['persist''remove'])]
  25.     private $percentageSplits;
  26.     #[ORM\OneToMany(mappedBy'product'targetEntityFilmProject::class)]
  27.     private $filmProjects;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $accountId null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $refundCode null;
  32.     #[ORM\OneToMany(mappedBy'recurringProduct'targetEntityFilmProject::class)]
  33.     private Collection $recurringFilmProjects;
  34.     public function __construct()
  35.     {
  36.         $this->percentageSplits = new ArrayCollection();
  37.         $this->filmProjects = new ArrayCollection();
  38.         $this->recurringFilmProjects = 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): self
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function getCategory(): ?string
  54.     {
  55.         return $this->category;
  56.     }
  57.     public function setCategory(?string $category): self
  58.     {
  59.         $this->category $category;
  60.         return $this;
  61.     }
  62.     public function getDescription(): ?string
  63.     {
  64.         return $this->description;
  65.     }
  66.     public function setDescription(?string $description): self
  67.     {
  68.         $this->description $description;
  69.         return $this;
  70.     }
  71.     public function getPrice(): ?float
  72.     {
  73.         return $this->price;
  74.     }
  75.     public function setPrice(?float $price): self
  76.     {
  77.         $this->price $price;
  78.         return $this;
  79.     }
  80.     public function getGlCode(): ?string
  81.     {
  82.         return $this->glCode;
  83.     }
  84.     public function setGlCode(?string $glCode): self
  85.     {
  86.         $this->glCode $glCode;
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection<int, ProductPercentageSplit>
  91.      */
  92.     public function getPercentageSplits(): Collection
  93.     {
  94.         return $this->percentageSplits;
  95.     }
  96.     public function addPercentageSplit(ProductPercentageSplit $percentageSplit): self
  97.     {
  98.         if (!$this->percentageSplits->contains($percentageSplit)) {
  99.             $this->percentageSplits[] = $percentageSplit;
  100.             $percentageSplit->setProduct($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removePercentageSplit(ProductPercentageSplit $percentageSplit): self
  105.     {
  106.         if ($this->percentageSplits->removeElement($percentageSplit)) {
  107.             // set the owning side to null (unless already changed)
  108.             if ($percentageSplit->getProduct() === $this) {
  109.                 $percentageSplit->setProduct(null);
  110.             }
  111.         }
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return Collection<int, FilmProject>
  116.      */
  117.     public function getFilmProjects(): Collection
  118.     {
  119.         return $this->filmProjects;
  120.     }
  121.     public function addFilmProject(FilmProject $filmProject): self
  122.     {
  123.         if (!$this->filmProjects->contains($filmProject)) {
  124.             $this->filmProjects[] = $filmProject;
  125.             $filmProject->setProduct($this);
  126.         }
  127.         return $this;
  128.     }
  129.     public function removeFilmProject(FilmProject $filmProject): self
  130.     {
  131.         if ($this->filmProjects->removeElement($filmProject)) {
  132.             // set the owning side to null (unless already changed)
  133.             if ($filmProject->getProduct() === $this) {
  134.                 $filmProject->setProduct(null);
  135.             }
  136.         }
  137.         return $this;
  138.     }
  139.     public function toString()
  140.     {
  141.         if ($this->name) {
  142.             return $this->name;
  143.         }
  144.         return 'Not set';
  145.     }
  146.     public function __toString()
  147.     {
  148.         return $this->toString();
  149.     }
  150.     public function getAccountId(): ?string
  151.     {
  152.         return $this->accountId;
  153.     }
  154.     public function setAccountId(?string $accountId): self
  155.     {
  156.         $this->accountId $accountId;
  157.         return $this;
  158.     }
  159.     public function getRefundCode(): ?string
  160.     {
  161.         return $this->refundCode;
  162.     }
  163.     public function setRefundCode(?string $refundCode): static
  164.     {
  165.         $this->refundCode $refundCode;
  166.         return $this;
  167.     }
  168.     /**
  169.      * @return Collection<int, FilmProject>
  170.      */
  171.     public function getRecurringFilmProjects(): Collection
  172.     {
  173.         return $this->recurringFilmProjects;
  174.     }
  175.     public function addRecurringFilmProject(FilmProject $recurringFilmProject): static
  176.     {
  177.         if (!$this->recurringFilmProjects->contains($recurringFilmProject)) {
  178.             $this->recurringFilmProjects->add($recurringFilmProject);
  179.             $recurringFilmProject->setRecurringProduct($this);
  180.         }
  181.         return $this;
  182.     }
  183.     public function removeRecurringFilmProject(FilmProject $recurringFilmProject): static
  184.     {
  185.         if ($this->recurringFilmProjects->removeElement($recurringFilmProject)) {
  186.             // set the owning side to null (unless already changed)
  187.             if ($recurringFilmProject->getRecurringProduct() === $this) {
  188.                 $recurringFilmProject->setRecurringProduct(null);
  189.             }
  190.         }
  191.         return $this;
  192.     }
  193. }