<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\BFOrderEditionRepository")
*/
class BFOrderEdition
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\BFProductEdition", inversedBy="bFOrderEditions" , cascade={"persist"})
*/
private $productedition;
/**
* @ORM\Column(type="integer")
*/
private $quantity;
/**
* @ORM\Column(type="text")
*/
private $description;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\BFPaymentIntentEdition", inversedBy="ordereditions")
* @ORM\JoinColumn(nullable=false)
*/
private $bFPaymentIntentEdition;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $feebf;
public function __construct()
{
$this->feebf=50; //by default is 0.50€ by quantity
}
public function getId(): ?int
{
return $this->id;
}
public function getProductedition(): ?BFProductEdition
{
return $this->productedition;
}
public function setProductedition(?BFProductEdition $productedition): self
{
$this->productedition = $productedition;
//Update the fee to apply
$this->setFeebf($productedition->getFeebf());
return $this;
}
public function getQuantity(): ?int
{
return $this->quantity;
}
public function setQuantity(int $quantity): self
{
$this->quantity = $quantity;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getDisplayTotal(): ?float
{
return $this->getProductEdition()->getDisplayprice()*$this->getQuantity();
}
public function getBFPaymentIntentEdition(): ?BFPaymentIntentEdition
{
return $this->bFPaymentIntentEdition;
}
public function setBFPaymentIntentEdition(?BFPaymentIntentEdition $bFPaymentIntentEdition): self
{
$this->bFPaymentIntentEdition = $bFPaymentIntentEdition;
return $this;
}
public function getFeebf(): ?int
{
return $this->feebf;
}
public function setFeebf(?int $feebf): self
{
$this->feebf = $feebf;
return $this;
}
}