src/Entity/Management/Subscription/Formule.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Management\Subscription;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. /**
  7.  * Formule
  8.  *
  9.  * @ORM\Table(name="admin_formule")
  10.  * @ORM\Entity()
  11.  */
  12. class Formule extends Offer
  13. {
  14.     /**
  15.      * @ORM\Column(type="float",nullable=true)
  16.      *
  17.      */
  18.     private $oldPrice;
  19.     /**
  20.      * @ORM\Column(type="float",nullable=true)
  21.      *
  22.      */
  23.     private $percentDiscount;
  24.     /**
  25.      * @ORM\Column(type="integer",nullable=true,name="monthValid")
  26.      *
  27.      */
  28.     private $monthValid;
  29.     /**
  30.      * @ORM\Column(name="role",type="string",length=255)
  31.      */
  32.     private $role;
  33.     /**
  34.      * @ORM\Column(type="boolean",nullable=true)
  35.      */
  36.     private $tutorat;
  37.     /**
  38.      * @ORM\Column(type="boolean",nullable=true,options={"default":0})
  39.      */
  40.     private $displayEcoText;
  41.     /**
  42.      * @ORM\ManyToOne(targetEntity=Discount::class)
  43.      */
  44.     private $discount;
  45.     /**
  46.      * @ORM\Column(type="datetime",nullable=true)
  47.      *
  48.      */
  49.     private $discountDate;
  50.     /************************* ASSOCIATION **********************/
  51.     private $packs;
  52.     /**************************** FIN ***************************/
  53.     public function __construct()
  54.     {
  55.         parent::__construct();
  56.         $this->packs = new ArrayCollection();
  57.         $this->role = "ROLE_FO";
  58.         $this->tutorat = false;
  59.     }
  60.     /**
  61.      * @return mixed
  62.      */
  63.     public function getPlanning()
  64.     {
  65.         return $this->planning;
  66.     }
  67.     /**
  68.      * @param mixed $planning
  69.      */
  70.     public function setPlanning($planning)
  71.     {
  72.         $this->planning = $planning;
  73.     }
  74.     /**
  75.      * @return mixed
  76.      */
  77.     public function getPacks()
  78.     {
  79.         return $this->packs;
  80.     }
  81.     /**
  82.      * @param mixed $packs
  83.      */
  84.     public function addPacks($packs)
  85.     {
  86.         $this->packs[] = $packs;
  87.     }
  88.     /**
  89.      * Get id
  90.      *
  91.      * @return integer
  92.      */
  93.     public function getId()
  94.     {
  95.         return $this->id;
  96.     }
  97.     /**
  98.      * Set title
  99.      *
  100.      * @param string $title
  101.      * @return Formule
  102.      */
  103.     public function setTitle($title)
  104.     {
  105.         $this->title = $title;
  106.         return $this;
  107.     }
  108.     /**
  109.      * Get title
  110.      *
  111.      * @return string
  112.      */
  113.     public function getTitle()
  114.     {
  115.         return $this->title;
  116.     }
  117.     /**
  118.      * Set description
  119.      *
  120.      * @param string $description
  121.      * @return Formule
  122.      */
  123.     public function setDescription($description)
  124.     {
  125.         $this->description = $description;
  126.         return $this;
  127.     }
  128.     /**
  129.      * Get description
  130.      *
  131.      * @return string
  132.      */
  133.     public function getDescription()
  134.     {
  135.         return $this->description;
  136.     }
  137.     /**
  138.      * Set price
  139.      *
  140.      * @param float $price
  141.      * @return Formule
  142.      */
  143.     public function setPrice($price)
  144.     {
  145.         $this->price = $price;
  146.         return $this;
  147.     }
  148.     /**
  149.      * Get price
  150.      *
  151.      * @return float
  152.      */
  153.     public function getPrice()
  154.     {
  155.         return $this->price;
  156.     }
  157.     public function __toString()
  158.     {
  159.         return $this->title;
  160.     }
  161.     /**
  162.      * @return mixed
  163.      */
  164.     public function getParentsFeature()
  165.     {
  166.         return $this->parentsFeature;
  167.     }
  168.     /**
  169.      * @param mixed $parentsFeature
  170.      */
  171.     public function setParentsFeature($parentsFeature)
  172.     {
  173.         $this->parentsFeature = $parentsFeature;
  174.     }
  175.     /**
  176.      * @return mixed
  177.      */
  178.     public function getChildrenFeature()
  179.     {
  180.         return $this->childrenFeature;
  181.     }
  182.     /**
  183.      * @param mixed $childrenFeature
  184.      */
  185.     public function setChildrenFeature($childrenFeature)
  186.     {
  187.         $this->childrenFeature = $childrenFeature;
  188.     }
  189.     public function getPriceFront()
  190.     {
  191.         $price = explode('.',$this->price);
  192.         return sprintf('%s,<sup>%s</sup> €',$price[0],isset($price[1])&&!empty($price[1])?$price[1]:"00");
  193.     }
  194.     /**
  195.      * @param mixed $role
  196.      */
  197.     public function setRole($role)
  198.     {
  199.         $this->role = $role;
  200.     }
  201.     /**
  202.      * @return mixed
  203.      */
  204.     public function getMonthValid()
  205.     {
  206.         return $this->monthValid;
  207.     }
  208.     /**
  209.      * @param mixed $monthValid
  210.      */
  211.     public function setMonthValid($monthValid): void
  212.     {
  213.         $this->monthValid = $monthValid;
  214.     }
  215.     /**
  216.      * @return false
  217.      */
  218.     public function getTutorat(): ?bool
  219.     {
  220.         return $this->tutorat;
  221.     }
  222.     /**
  223.      * @param false $tutorat
  224.      */
  225.     public function setTutorat(bool $tutorat): void
  226.     {
  227.         $this->tutorat = $tutorat;
  228.     }
  229.     /**
  230.      * @return mixed
  231.      */
  232.     public function getOldPrice()
  233.     {
  234.         return $this->oldPrice;
  235.     }
  236.     /**
  237.      * @param mixed $oldPrice
  238.      */
  239.     public function setOldPrice($oldPrice): void
  240.     {
  241.         $this->oldPrice = $oldPrice;
  242.     }
  243.     /**
  244.      * @return mixed
  245.      */
  246.     public function getRole()
  247.     {
  248.         return $this->role;
  249.     }
  250.     /**
  251.      * @return mixed
  252.      */
  253.     public function getDiscount()
  254.     {
  255.         return $this->discount;
  256.     }
  257.     /**
  258.      * @param mixed $discount
  259.      */
  260.     public function setDiscount($discount): void
  261.     {
  262.         $this->discount = $discount;
  263.     }
  264.     public function getDiscountDate(): ?\Datetime
  265.     {
  266.         return $this->discountDate;
  267.     }
  268.     public function setDiscountDate(?\Datetime $discountDate): void
  269.     {
  270.         $this->discountDate = $discountDate;
  271.     }
  272.     public function getAmount(){
  273.         if(is_null($this->discount)){
  274.             return $this->price;
  275.         }
  276.         $som = $this->price - (($this->discount->getPercent()/100) * $this->price);
  277.         return round($som,2);
  278.     }
  279.     /**
  280.      * @return mixed
  281.      */
  282.     public function getPercentDiscount()
  283.     {
  284.         return $this->percentDiscount;
  285.     }
  286.     /**
  287.      * @param mixed $percentDiscount
  288.      */
  289.     public function setPercentDiscount($percentDiscount): void
  290.     {
  291.         $this->percentDiscount = $percentDiscount;
  292.     }
  293.     /**
  294.      * @return mixed
  295.      */
  296.     public function getDisplayEcoText()
  297.     {
  298.         return $this->displayEcoText;
  299.     }
  300.     /**
  301.      * @param mixed $displayEcoText
  302.      */
  303.     public function setDisplayEcoText($displayEcoText): void
  304.     {
  305.         $this->displayEcoText = $displayEcoText;
  306.     }
  307. }