src/Entity/BFOrderEdition.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity(repositoryClass="App\Repository\BFOrderEditionRepository")
  6.  */
  7. class BFOrderEdition
  8. {
  9.     /**
  10.      * @ORM\Id()
  11.      * @ORM\GeneratedValue()
  12.      * @ORM\Column(type="integer")
  13.      */
  14.     private $id;
  15.     /**
  16.      * @ORM\ManyToOne(targetEntity="App\Entity\BFProductEdition", inversedBy="bFOrderEditions" , cascade={"persist"})
  17.      */
  18.     private $productedition;
  19.     /**
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $quantity;
  23.     /**
  24.      * @ORM\Column(type="text")
  25.      */
  26.     private $description;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity="App\Entity\BFPaymentIntentEdition", inversedBy="ordereditions")
  29.      * @ORM\JoinColumn(nullable=false)
  30.      */
  31.     private $bFPaymentIntentEdition;
  32.     
  33.     /**
  34.      * @ORM\Column(type="integer", nullable=true)
  35.      */
  36.     private $feebf;
  37.     
  38.     public function __construct()
  39.     {
  40.         $this->feebf=50//by default is 0.50€ by quantity
  41.     }
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getProductedition(): ?BFProductEdition
  47.     {
  48.         return $this->productedition;
  49.     }
  50.     public function setProductedition(?BFProductEdition $productedition): self
  51.     {
  52.         $this->productedition $productedition;
  53.         
  54.         //Update the fee to apply        
  55.         $this->setFeebf($productedition->getFeebf());
  56.         return $this;
  57.     }
  58.     public function getQuantity(): ?int
  59.     {
  60.         return $this->quantity;
  61.     }
  62.     public function setQuantity(int $quantity): self
  63.     {
  64.         $this->quantity $quantity;
  65.         return $this;
  66.     }
  67.     public function getDescription(): ?string
  68.     {
  69.         return $this->description;
  70.     }
  71.     public function setDescription(string $description): self
  72.     {
  73.         $this->description $description;
  74.         return $this;
  75.     }
  76.     
  77.     public function getDisplayTotal(): ?float
  78.     {
  79.         return $this->getProductEdition()->getDisplayprice()*$this->getQuantity();    
  80.     }
  81.     public function getBFPaymentIntentEdition(): ?BFPaymentIntentEdition
  82.     {
  83.         return $this->bFPaymentIntentEdition;
  84.     }
  85.     public function setBFPaymentIntentEdition(?BFPaymentIntentEdition $bFPaymentIntentEdition): self
  86.     {
  87.         $this->bFPaymentIntentEdition $bFPaymentIntentEdition;
  88.         return $this;
  89.     }
  90.     public function getFeebf(): ?int
  91.     {
  92.         return $this->feebf;
  93.     }
  94.     public function setFeebf(?int $feebf): self
  95.     {
  96.         $this->feebf $feebf;
  97.         return $this;
  98.     }
  99. }