src/Entity/CRM/OrderProduct.php line 14
<?phpnamespace App\Entity\CRM;use App\Repository\OrderProductRepository;use DateTime;use DateTimeInterface;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: OrderProductRepository::class)]class OrderProduct{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column]private ?float $priceSubtotal = null;private float $priceTotal;private float $productSumSubtotal;private float $productSumTotal;#[ORM\Column]private ?int $quantity = null;#[ORM\Column(type: Types::DATETIME_MUTABLE)]private DateTimeInterface $addedDate;#[ORM\Column(type: Types::DATETIME_MUTABLE,nullable: true)]private ?DateTimeInterface $modifiedDate = null;#[ORM\ManyToOne(inversedBy: 'orderProduct')]#[ORM\JoinColumn(nullable: false)]private ?Order $orderId = null;#[ORM\ManyToOne(inversedBy: 'orderProducts', cascade: ['persist'])]#[ORM\JoinColumn(nullable: false)]private ?Product $product = null;#[ORM\OneToMany(mappedBy: 'orderProduct', targetEntity: ImplementerOrderProduct::class, orphanRemoval: true)]private Collection $implementerOrderProducts;#[ORM\OneToMany(mappedBy: 'orderProduct', targetEntity: BhpOrderProduct::class, orphanRemoval: true)]private Collection $BhpOrderProducts;#[ORM\Column]private bool $autoMailBlock = false;#[ORM\Column]private bool $sendedMail = false;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $sendedDate = null;#[ORM\Column(nullable: true)]private ?int $administrationFee = null;public function __construct(){$this->addedDate = new DateTime();$this->implementerOrderProducts = new ArrayCollection();$this->BhpOrderProducts = new ArrayCollection();$this->autoMailBlock = false;$this->sendedMail = false;}public function __toString(): string{return $this->product->getName();}public function getId(): ?int{return $this->id;}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->product->getTax() / 100));}public function getQuantity(): ?int{return $this->quantity;}public function setQuantity(int $quantity): self{$this->quantity = $quantity;return $this;}public function getAddedDate(): DateTimeInterface{return $this->addedDate;}public function getModifiedDate(): ?DateTimeInterface{return $this->modifiedDate;}public function setModifiedDate(): self{$this->modifiedDate = new DateTime();return $this;}public function getOrderId(): ?Order{return $this->orderId;}public function setOrderId(?Order $orderId): self{$this->orderId = $orderId;return $this;}public function getProduct(): ?Product{return $this->product;}public function setProduct(?Product $product): self{$this->product = $product;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->setOrderProduct($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->getOrderProduct() === $this) {$implementerOrderProduct->setOrderProduct(null);}}return $this;}/*** @return Collection<int, BhpOrderProduct>*/public function getBhpOrderProducts(): Collection{return $this->BhpOrderProducts;}public function addBhpOrderProduct(BhpOrderProduct $BhpOrderProduct): static{if (!$this->BhpOrderProducts->contains($BhpOrderProduct)) {$this->BhpOrderProducts->add($BhpOrderProduct);$BhpOrderProduct->setOrderProduct($this);}return $this;}public function isAutoMailBlock(): ?bool{return $this->autoMailBlock;}public function setAutoMailBlock(bool $autoMailBlock): static{$this->autoMailBlock = $autoMailBlock;return $this;}public function removeBhpOrderProduct(BhpOrderProduct $BhpOrderProduct): static{if ($this->BhpOrderProducts->removeElement($BhpOrderProduct)) {// set the owning side to null (unless already changed)if ($BhpOrderProduct->getOrderProduct() === $this) {$BhpOrderProduct->setOrderProduct(null);}}return $this;}public function isSendedMail(): ?bool{return $this->sendedMail;}public function setSendedMail(bool $sendedMail): static{$this->sendedMail = $sendedMail;return $this;}public function getSendedDate(): ?\DateTimeInterface{return $this->sendedDate;}public function setSendedDate(?\DateTimeInterface $sendedDate): static{$this->sendedDate = $sendedDate;return $this;}public function getAdministrationFee(): ?int{return $this->administrationFee;}public function setAdministrationFee(int $administrationFee): static{$this->administrationFee = $administrationFee;return $this;}public function getOrderProductAgreementToken(): string{$token = match ($this->product->getAgreement()->getType()) {'rodo' => $this->orderId->getToken(),'aml' => $this->orderId->getTokenAml(),'amlrodo' => $this->orderId->getTokenAmlrodo(),'bdo' => $this->orderId->getTokenBdo(),'bhpstacjonarna' => $this->orderId->getTokenBhpStationary(),'biurarachunkowe' => $this->orderId->getTokenOffice(),'iod' => $this->orderId->getTokenIod(),'rodobhp' => $this->orderId->getTokenBhpRodo(),'licencyjnewebaml' => $this->orderId->getTokenLicencyjnaWebAml(),'licencyjnewebamlpartnerska' => $this->orderId->getTokenLicencyjnaWebAmlPartnerska(),'licencyjnewebamlnieruchomosci' => $this->orderId->getTokenLicencyjnaWebAmlNieruchomosci(),default => '',};if($token){return $token;}else{return '';}}}