<?php
namespace App\Entity\Management\Subscription;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* Formule
*
* @ORM\Table(name="admin_formule")
* @ORM\Entity()
*/
class Formule extends Offer
{
/**
* @ORM\Column(type="float",nullable=true)
*
*/
private $oldPrice;
/**
* @ORM\Column(type="float",nullable=true)
*
*/
private $percentDiscount;
/**
* @ORM\Column(type="integer",nullable=true,name="monthValid")
*
*/
private $monthValid;
/**
* @ORM\Column(name="role",type="string",length=255)
*/
private $role;
/**
* @ORM\Column(type="boolean",nullable=true)
*/
private $tutorat;
/**
* @ORM\Column(type="boolean",nullable=true,options={"default":0})
*/
private $displayEcoText;
/**
* @ORM\ManyToOne(targetEntity=Discount::class)
*/
private $discount;
/**
* @ORM\Column(type="datetime",nullable=true)
*
*/
private $discountDate;
/************************* ASSOCIATION **********************/
private $packs;
/**************************** FIN ***************************/
public function __construct()
{
parent::__construct();
$this->packs = new ArrayCollection();
$this->role = "ROLE_FO";
$this->tutorat = false;
}
/**
* @return mixed
*/
public function getPlanning()
{
return $this->planning;
}
/**
* @param mixed $planning
*/
public function setPlanning($planning)
{
$this->planning = $planning;
}
/**
* @return mixed
*/
public function getPacks()
{
return $this->packs;
}
/**
* @param mixed $packs
*/
public function addPacks($packs)
{
$this->packs[] = $packs;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
* @return Formule
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set description
*
* @param string $description
* @return Formule
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set price
*
* @param float $price
* @return Formule
*/
public function setPrice($price)
{
$this->price = $price;
return $this;
}
/**
* Get price
*
* @return float
*/
public function getPrice()
{
return $this->price;
}
public function __toString()
{
return $this->title;
}
/**
* @return mixed
*/
public function getParentsFeature()
{
return $this->parentsFeature;
}
/**
* @param mixed $parentsFeature
*/
public function setParentsFeature($parentsFeature)
{
$this->parentsFeature = $parentsFeature;
}
/**
* @return mixed
*/
public function getChildrenFeature()
{
return $this->childrenFeature;
}
/**
* @param mixed $childrenFeature
*/
public function setChildrenFeature($childrenFeature)
{
$this->childrenFeature = $childrenFeature;
}
public function getPriceFront()
{
$price = explode('.',$this->price);
return sprintf('%s,<sup>%s</sup> €',$price[0],isset($price[1])&&!empty($price[1])?$price[1]:"00");
}
/**
* @param mixed $role
*/
public function setRole($role)
{
$this->role = $role;
}
/**
* @return mixed
*/
public function getMonthValid()
{
return $this->monthValid;
}
/**
* @param mixed $monthValid
*/
public function setMonthValid($monthValid): void
{
$this->monthValid = $monthValid;
}
/**
* @return false
*/
public function getTutorat(): ?bool
{
return $this->tutorat;
}
/**
* @param false $tutorat
*/
public function setTutorat(bool $tutorat): void
{
$this->tutorat = $tutorat;
}
/**
* @return mixed
*/
public function getOldPrice()
{
return $this->oldPrice;
}
/**
* @param mixed $oldPrice
*/
public function setOldPrice($oldPrice): void
{
$this->oldPrice = $oldPrice;
}
/**
* @return mixed
*/
public function getRole()
{
return $this->role;
}
/**
* @return mixed
*/
public function getDiscount()
{
return $this->discount;
}
/**
* @param mixed $discount
*/
public function setDiscount($discount): void
{
$this->discount = $discount;
}
public function getDiscountDate(): ?\Datetime
{
return $this->discountDate;
}
public function setDiscountDate(?\Datetime $discountDate): void
{
$this->discountDate = $discountDate;
}
public function getAmount(){
if(is_null($this->discount)){
return $this->price;
}
$som = $this->price - (($this->discount->getPercent()/100) * $this->price);
return round($som,2);
}
/**
* @return mixed
*/
public function getPercentDiscount()
{
return $this->percentDiscount;
}
/**
* @param mixed $percentDiscount
*/
public function setPercentDiscount($percentDiscount): void
{
$this->percentDiscount = $percentDiscount;
}
/**
* @return mixed
*/
public function getDisplayEcoText()
{
return $this->displayEcoText;
}
/**
* @param mixed $displayEcoText
*/
public function setDisplayEcoText($displayEcoText): void
{
$this->displayEcoText = $displayEcoText;
}
}