src/Entity/CRM/Product.php line 12
<?phpnamespace App\Entity\CRM;use App\Repository\ProductRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Finder\Finder;#[ORM\Entity(repositoryClass: ProductRepository::class)]class Product{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\Column]private ?float $priceSubtotal = null;#[ORM\Column]private bool $implementation = false;#[ORM\Column]private bool $parent = false;#[ORM\Column]private bool $eumowa = false;#[ORM\Column]private bool $umowa = false;#[ORM\Column]private bool $eumowabiuro = false;#[ORM\Column]private bool $eumowarodobhp = false;#[ORM\Column]private bool $eumowaiod = false;#[ORM\Column]private bool $eumowabdo = false;#[ORM\Column]private bool $eumowabhpstacjonarna = false;#[ORM\Column]private bool $audytbezpieczenstwa = false;#[ORM\Column]private bool $sprawozdanie = false;#[ORM\Column]private bool $doSprawozdania = false;#[ORM\Column(nullable: true)]private ?int $platformProductId = null;#[ORM\Column(nullable: true)]private ?int $optimaCodeId = null;#[ORM\Column(nullable: true)]private int $tax;#[ORM\ManyToMany(targetEntity: ProductCategory::class, inversedBy: 'products')]private Collection $category;#[ORM\Column]private bool $isActive = true;#[ORM\OneToMany(mappedBy: 'product', targetEntity: OrderProduct::class)]private Collection $orderProducts;#[ORM\ManyToOne(inversedBy: 'products')]private ?ContractTemplate $contractTemplate = null;#[ORM\Column(length: 1500, nullable: true)]private ?string $paragraphOfContract = null;#[ORM\Column]private bool $forBhp = false;#[ORM\ManyToMany(targetEntity: self::class, inversedBy: 'childProducts')]private Collection $parentProducts;#[ORM\ManyToMany(targetEntity: self::class, mappedBy: 'parentProducts')]private Collection $childProducts;#[ORM\OneToMany(mappedBy: 'product', targetEntity: ImplementerOrderProduct::class)]private Collection $implementerOrderProducts;#[ORM\Column]private bool $forBR = false;#[ORM\Column]private bool $haveMailAttachments = false;private array $files = [];#[ORM\Column]private bool $autoMail = false;#[ORM\OneToMany(mappedBy: 'product', targetEntity: ConsultantReward::class)]private Collection $consultantRewards;#[ORM\OneToMany(mappedBy: 'product', targetEntity: DepartmentTypeProductReward::class, orphanRemoval: true)]private Collection $departmentTypeProductRewards;#[ORM\Column]private ?bool $additionalCourses = null;#[ORM\ManyToOne(inversedBy: 'products')]private ?Agreement $agreement = null;#[ORM\Column]private ?bool $eumowaamlrodo = null;#[ORM\Column]private ?bool $eumowaaml = null;#[ORM\Column]private ?bool $transport = null;#[ORM\Column]private bool $automaticallyDoBeforePayment = false;#[ORM\Column]private bool $endWithoutAudit = false;#[ORM\ManyToMany(targetEntity: Admin::class, inversedBy: 'products')]private Collection $adminToInfo;#[ORM\Column]private ?bool $auditRemote = null;#[ORM\Column]private bool $eumowalicencyjnawebaml = false;#[ORM\Column]private bool $eumowalicencyjnawebamlpartnerska = false;#[ORM\Column]private ?bool $freeWebinar = null;#[ORM\Column]private bool $eumowalicencyjnawebamlnieruchomosci = false;#[ORM\Column(length: 255, nullable: true)]private ?string $licenseType = null;#[ORM\Column]private int $administrationFee = 0;#[ORM\ManyToMany(targetEntity: self::class)]#[ORM\JoinTable(name: 'product_similar_products')]private Collection $similarProducts;#[ORM\Column]private ?bool $protocol = null;#[ORM\Column]private ?bool $zoom = null;public function __construct(){$this->category = new ArrayCollection();$this->orderProducts = new ArrayCollection();$this->contracts = new ArrayCollection();$this->parentProducts = new ArrayCollection();$this->childProducts = new ArrayCollection();$this->implementerOrderProducts = new ArrayCollection();$this->consultantRewards = new ArrayCollection();$this->departmentTypeProductRewards = new ArrayCollection();$this->adminToInfo = new ArrayCollection();$this->similarProducts = new ArrayCollection();$this->optimaCodeId = NULL;}public function __toString(): string{return $this->id . ' ' . $this->name;}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(string $name): self{$this->name = $name;return $this;}public function getPriceSubtotal(): ?float{return $this->priceSubtotal;}public function setPriceSubtotal(float $priceSubtotal): self{$this->priceSubtotal = $priceSubtotal;return $this;}public function getPriceTotal(): ?float{return $this->priceSubtotal + ($this->priceSubtotal * ($this->tax / 100));}public function isImplementation(): ?bool{return $this->implementation;}public function setImplementation(bool $implementation): self{$this->implementation = $implementation;return $this;}public function isParent(): ?bool{return $this->parent;}public function setParent(bool $parent): self{$this->parent = $parent;return $this;}public function isEumowa(): ?bool{return $this->eumowa;}public function setEumowa(bool $eumowa): self{$this->eumowa = $eumowa;return $this;}public function isUmowa(): ?bool{return $this->umowa;}public function setUmowa(bool $umowa): self{$this->umowa = $umowa;return $this;}public function isEumowabiuro(): ?bool{return $this->eumowabiuro;}public function setEumowabiuro(bool $eumowabiuro): self{$this->eumowabiuro = $eumowabiuro;return $this;}public function isEumowarodobhp(): ?bool{return $this->eumowarodobhp;}public function setEumowarodobhp(bool $eumowarodobhp): self{$this->eumowarodobhp = $eumowarodobhp;return $this;}public function isEumowaiod(): ?bool{return $this->eumowaiod;}public function setEumowaiod(bool $eumowaiod): self{$this->eumowaiod = $eumowaiod;return $this;}public function isEumowabdo(): ?bool{return $this->eumowabdo;}public function setEumowabdo(bool $eumowabdo): self{$this->eumowabdo = $eumowabdo;return $this;}public function isEumowabhpstacjonarna(): ?bool{return $this->eumowabhpstacjonarna;}public function setEumowabhpstacjonarna(bool $eumowabhpstacjonarna): self{$this->eumowabhpstacjonarna = $eumowabhpstacjonarna;return $this;}public function isAudytbezpieczenstwa(): ?bool{return $this->audytbezpieczenstwa;}public function setAudytbezpieczenstwa(bool $audytbezpieczenstwa): self{$this->audytbezpieczenstwa = $audytbezpieczenstwa;return $this;}public function isSprawozdanie(): ?bool{return $this->sprawozdanie;}public function setSprawozdanie(bool $sprawozdanie): self{$this->sprawozdanie = $sprawozdanie;return $this;}public function isDoSprawozdania(): ?bool{return $this->doSprawozdania;}public function setDoSprawozdania(bool $doSprawozdania): self{$this->doSprawozdania = $doSprawozdania;return $this;}public function getTax(): int{return $this->tax;}public function setTax(int $tax): void{$this->tax = $tax;}public function getPlatformProductId(): ?int{return $this->platformProductId;}public function setPlatformProductId(?int $platformProductId): self{$this->platformProductId = $platformProductId;return $this;}public function getOptimaCodeId(): ?int{return $this->optimaCodeId;}public function setOptimaCodeId(?int $optimaCodeId): self{$this->optimaCodeId = $optimaCodeId;return $this;}public function getCategory(): Collection{return $this->category;}public function addCategory(ProductCategory $category): self{if (!$this->category->contains($category)) {$this->category->add($category);}return $this;}public function removeCategory(ProductCategory $category): self{$this->category->removeElement($category);return $this;}public function isIsActive(): ?bool{return $this->isActive;}public function setIsActive(bool $isActive): self{$this->isActive = $isActive;return $this;}public function getOrderProducts(): Collection{return $this->orderProducts;}public function addOrderProduct(OrderProduct $orderProduct): self{if (!$this->orderProducts->contains($orderProduct)) {$this->orderProducts->add($orderProduct);$orderProduct->setProduct($this);}return $this;}public function removeOrderProduct(OrderProduct $orderProduct): self{if ($this->orderProducts->removeElement($orderProduct)) {if ($orderProduct->getProduct() === $this) {$orderProduct->setProduct(null);}}return $this;}public function getContractTemplate(): ?ContractTemplate{return $this->contractTemplate;}public function setContractTemplate(?ContractTemplate $contractTemplate): static{$this->contractTemplate = $contractTemplate;return $this;}/*** @param int|null $id*/public function setId(?int $id): void{$this->id = $id;}public function getParagraphOfContract(): ?string{return $this->paragraphOfContract;}public function setParagraphOfContract(?string $paragraphOfContract): static{$this->paragraphOfContract = $paragraphOfContract;return $this;}/*** @return Collection<int, self>*/public function getParentProducts(): Collection{return $this->parentProducts;}public function addParentProduct(self $parentProduct): static{if (!$this->parentProducts->contains($parentProduct)) {$this->parentProducts->add($parentProduct);}return $this;}public function removeParentProduct(self $parentProduct): static{$this->parentProducts->removeElement($parentProduct);return $this;}/*** @return Collection<int, self>*/public function getChildProducts(): Collection{return $this->childProducts;}public function addChildProduct(self $childProduct): static{if (!$this->childProducts->contains($childProduct)) {$this->childProducts->add($childProduct);$childProduct->addParentProduct($this);}return $this;}public function removeChildProduct(self $childProduct): static{if ($this->childProducts->removeElement($childProduct)) {$childProduct->removeParentProduct($this);}return $this;}/*** @return Collection<int, ImplementerOrderProduct>*/public function getImplementerOrderProducts(): Collection{return $this->implementerOrderProducts;}public function addImplementerOrderProduct(ImplementerOrderProduct $implementerOrderProduct): static{if (!$this->implementerOrderProducts->contains($implementerOrderProduct)) {$this->implementerOrderProducts->add($implementerOrderProduct);$implementerOrderProduct->setProduct($this);}return $this;}public function removeImplementerOrderProduct(ImplementerOrderProduct $implementerOrderProduct): static{if ($this->implementerOrderProducts->removeElement($implementerOrderProduct)) {// set the owning side to null (unless already changed)if ($implementerOrderProduct->getProduct() === $this) {$implementerOrderProduct->setProduct(null);}}return $this;}public function isForBhp(): bool{return $this->forBhp;}public function setForBhp(?bool $forBhp): self{if($forBhp===null){$this->forBhp = false;}else{$this->forBhp = $forBhp;}return $this;}public function isForBR(): ?bool{return $this->forBR;}public function setForBR(?bool $forBR): static{if($forBR===null){$this->forBR = false;}else{$this->forBR = $forBR;}return $this;}public function isHaveMailAttachments(): ?bool{return $this->haveMailAttachments;}public function setHaveMailAttachments(?bool $haveMailAttachments): static{if($haveMailAttachments===null){$this->haveMailAttachments = false;}else{$this->haveMailAttachments = $haveMailAttachments;}return $this;}public function getFiles(): array{$finder = new Finder();$files = [];$ds = DIRECTORY_SEPARATOR;$projectDir = getenv('PROJECT_DIR');$targetPath = 'products' . $ds . $this->getId() . $ds;if (!file_exists($targetPath)) {$targetPath = $projectDir . $ds . 'public' . $ds . $targetPath;if (!file_exists($targetPath)) {$targetPath = 'public' . $ds . 'products' . $ds . $this->getId() . $ds;}}if (file_exists($targetPath)) {$finder->in($targetPath);$productDir = $finder->files();foreach ($productDir as $file) {$files[$file->getFilename()] = ['name' => $file->getFilename(),'time' => $file->getMTime(),'path' => $file->getPath(),'pathAll' => $file->getPathname(),];}}return $files;}public function isAutoMail(): ?bool{return $this->autoMail;}public function setAutoMail(bool $autoMail): static{$this->autoMail = $autoMail;return $this;}/*** @return Collection<int, ConsultantReward>*/public function getConsultantRewards(): Collection{return $this->consultantRewards;}public function addConsultantReward(ConsultantReward $consultantReward): static{if (!$this->consultantRewards->contains($consultantReward)) {$this->consultantRewards->add($consultantReward);$consultantReward->setProduct($this);}return $this;}public function removeConsultantReward(ConsultantReward $consultantReward): static{if ($this->consultantRewards->removeElement($consultantReward)) {// set the owning side to null (unless already changed)if ($consultantReward->getProduct() === $this) {$consultantReward->setProduct(null);}}return $this;}/*** @return Collection<int, DepartmentTypeProductReward>*/public function getDepartmentTypeProductRewards(): Collection{return $this->departmentTypeProductRewards;}public function addDepartmentTypeProductReward(DepartmentTypeProductReward $departmentTypeProductReward): static{if (!$this->departmentTypeProductRewards->contains($departmentTypeProductReward)) {$this->departmentTypeProductRewards->add($departmentTypeProductReward);$departmentTypeProductReward->setProduct($this);}return $this;}public function removeDepartmentTypeProductReward(DepartmentTypeProductReward $departmentTypeProductReward): static{if ($this->departmentTypeProductRewards->removeElement($departmentTypeProductReward)) {// set the owning side to null (unless already changed)if ($departmentTypeProductReward->getProduct() === $this) {$departmentTypeProductReward->setProduct(null);}}return $this;}public function isAdditionalCourses(): ?bool{return $this->additionalCourses;}public function setAdditionalCourses(bool $additionalCourses): static{$this->additionalCourses = $additionalCourses;return $this;}public function getAgreement(): ?Agreement{return $this->agreement;}public function setAgreement(?Agreement $agreement): static{$this->agreement = $agreement;return $this;}public function isEumowaamlrodo(): ?bool{return $this->eumowaamlrodo;}public function setEumowaamlrodo(bool $eumowaamlrodo): static{$this->eumowaamlrodo = $eumowaamlrodo;return $this;}public function isEumowaaml(): ?bool{return $this->eumowaaml;}public function setEumowaaml(bool $eumowaaml): static{$this->eumowaaml = $eumowaaml;return $this;}public function isTransport(): ?bool{return $this->transport;}public function setTransport(?bool $transport): static{if($transport === null) {$this->transport = false;} else {$this->transport = $transport;}return $this;}public function isAutomaticallyDoBeforePayment(): ?bool{return $this->automaticallyDoBeforePayment;}public function setAutomaticallyDoBeforePayment(bool $automaticallyDoBeforePayment): static{$this->automaticallyDoBeforePayment = $automaticallyDoBeforePayment;return $this;}public function isEndWithoutAudit(): ?bool{return $this->endWithoutAudit;}public function setEndWithoutAudit(bool $endWithoutAudit): static{$this->endWithoutAudit = $endWithoutAudit;return $this;}/*** @return Collection<int, Admin>*/public function getAdminToInfo(): Collection{return $this->adminToInfo;}public function addAdminToInfo(Admin $adminToInfo): static{if (!$this->adminToInfo->contains($adminToInfo)) {$this->adminToInfo->add($adminToInfo);}return $this;}public function removeAdminToInfo(Admin $adminToInfo): static{$this->adminToInfo->removeElement($adminToInfo);return $this;}public function isAuditRemote(): ?bool{return $this->auditRemote;}public function setAuditRemote(bool $auditRemote): static{$this->auditRemote = $auditRemote;return $this;}public function isEumowalicencyjnawebaml(): ?bool{return $this->eumowalicencyjnawebaml;}public function setEumowalicencyjnawebaml(bool $eumowalicencyjnawebaml): static{$this->eumowalicencyjnawebaml = $eumowalicencyjnawebaml;return $this;}public function isEumowalicencyjnawebamlpartnerska(): ?bool{return $this->eumowalicencyjnawebamlpartnerska;}public function setEumowalicencyjnawebamlpartnerska(bool $eumowalicencyjnawebamlpartnerska): static{$this->eumowalicencyjnawebamlpartnerska = $eumowalicencyjnawebamlpartnerska;return $this;}public function isFreeWebinar(): ?bool{return $this->freeWebinar;}public function setFreeWebinar(bool $freeWebinar): static{$this->freeWebinar = $freeWebinar;return $this;}public function isEumowalicencyjnawebamlnieruchomosci(): ?bool{return $this->eumowalicencyjnawebamlnieruchomosci;}public function setEumowalicencyjnawebamlnieruchomosci(bool $eumowalicencyjnawebamlnieruchomosci): static{$this->eumowalicencyjnawebamlnieruchomosci = $eumowalicencyjnawebamlnieruchomosci;return $this;}public function getLicenseType(): ?string{return $this->licenseType;}public function setLicenseType(?string $licenseType): static{$this->licenseType = $licenseType;return $this;}public function getAdministrationFee(): int{return $this->administrationFee;}public function setAdministrationFee(int $administrationFee): void{$this->administrationFee = $administrationFee;}/*** @return Collection<int, self>*/public function getSimilarProducts(): Collection{return $this->similarProducts;}public function addSimilarProduct(self $similarProduct): static{if (!$this->similarProducts->contains($similarProduct)) {$this->similarProducts->add($similarProduct);}return $this;}public function removeSimilarProduct(self $similarProduct): static{$this->similarProducts->removeElement($similarProduct);return $this;}public function isProtocol(): ?bool{return $this->protocol;}public function setProtocol(bool $protocol): static{$this->protocol = $protocol;return $this;}public function isZoom(): ?bool{return $this->zoom;}public function setZoom(bool $zoom): static{$this->zoom = $zoom;return $this;}}