src/DcSiteBundle/Entity/CreditProgram.php line 13

Open in your IDE?
  1. <?php
  2. namespace DcSiteBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use CoreBundle\Entity\Dealer;
  5. use CoreBundle\Entity\Vehicles\Vehicle;
  6. use Doctrine\Common\Collections\Collection;
  7. /**
  8.  * CreditProgram
  9.  */
  10. class CreditProgram
  11. {
  12.     /**
  13.      * @var integer
  14.      */
  15.     private $id;
  16.     /**
  17.      * @var string
  18.      */
  19.     private $bank;
  20.     /**
  21.      * @var integer
  22.      */
  23.     private $state;
  24.     /**
  25.      * @var string
  26.      */
  27.     private $params;
  28.     /**
  29.      * @var Collection
  30.      */
  31.     private $dealer;
  32.     /**
  33.      * Constructor
  34.      */
  35.     public function __construct()
  36.     {
  37.         $this->dealer = new ArrayCollection();
  38.     }
  39.     public function __toString()
  40.     {
  41.         return $this->getBank().' | '.$this->getTitleUa();
  42.     }
  43.     /**
  44.      * Get id
  45.      *
  46.      * @return integer
  47.      */
  48.     public function getId()
  49.     {
  50.         return $this->id;
  51.     }
  52.     /**
  53.      * Set bank
  54.      *
  55.      * @param string $bank
  56.      *
  57.      * @return CreditProgram
  58.      */
  59.     public function setBank($bank)
  60.     {
  61.         $this->bank $bank;
  62.         return $this;
  63.     }
  64.     /**
  65.      * Get bank
  66.      *
  67.      * @return string
  68.      */
  69.     public function getBank()
  70.     {
  71.         return $this->bank;
  72.     }
  73.     /**
  74.      * Set state
  75.      *
  76.      * @param integer $state
  77.      *
  78.      * @return CreditProgram
  79.      */
  80.     public function setState($state)
  81.     {
  82.         $this->state $state;
  83.         return $this;
  84.     }
  85.     /**
  86.      * Get state
  87.      *
  88.      * @return integer
  89.      */
  90.     public function getState()
  91.     {
  92.         return $this->state 0;
  93.     }
  94.     /**
  95.      * Set params
  96.      *
  97.      * @param string $params
  98.      *
  99.      * @return CreditProgram
  100.      */
  101.     public function setParams($params)
  102.     {
  103.         $this->params $params;
  104.         return $this;
  105.     }
  106.     /**
  107.      * Get params
  108.      *
  109.      * @return string
  110.      */
  111.     public function getParams()
  112.     {
  113.         return $this->params;
  114.     }
  115.     /**
  116.      * Add dealer
  117.      *
  118.      * @param Dealer $dealer
  119.      *
  120.      * @return CreditProgram
  121.      */
  122.     public function addDealer(Dealer $dealer)
  123.     {
  124.         $this->dealer[] = $dealer;
  125.         return $this;
  126.     }
  127.     /**
  128.      * Remove dealer
  129.      *
  130.      * @param Dealer $dealer
  131.      */
  132.     public function removeDealer(Dealer $dealer)
  133.     {
  134.         $this->dealer->removeElement($dealer);
  135.     }
  136.     /**
  137.      * Get dealer
  138.      *
  139.      * @return Collection
  140.      */
  141.     public function getDealer()
  142.     {
  143.         return $this->dealer;
  144.     }
  145.     /**
  146.      * @var string
  147.      */
  148.     private $title_ru;
  149.     /**
  150.      * @var string
  151.      */
  152.     private $title_ua;
  153.     /**
  154.      * Set titleRu
  155.      *
  156.      * @param string $titleRu
  157.      *
  158.      * @return CreditProgram
  159.      */
  160.     public function setTitleRu($titleRu)
  161.     {
  162.         $this->title_ru $titleRu;
  163.         return $this;
  164.     }
  165.     /**
  166.      * Get titleRu
  167.      *
  168.      * @return string
  169.      */
  170.     public function getTitleRu()
  171.     {
  172.         return $this->title_ru;
  173.     }
  174.     /**
  175.      * Set titleUa
  176.      *
  177.      * @param string $titleUa
  178.      *
  179.      * @return CreditProgram
  180.      */
  181.     public function setTitleUa($titleUa)
  182.     {
  183.         $this->title_ua $titleUa;
  184.         return $this;
  185.     }
  186.     /**
  187.      * Get titleUa
  188.      *
  189.      * @return string
  190.      */
  191.     public function getTitleUa()
  192.     {
  193.         return $this->title_ua;
  194.     }
  195.     /**
  196.      * Get title
  197.      *
  198.      * @return string
  199.      */
  200.     public function getTitle($locale)
  201.     {
  202.         return $locale == 'ru' $this->title_ru $this->title_ua;
  203.     }
  204.     /**
  205.      * @var integer
  206.      */
  207.     private $minAvance;
  208.     /**
  209.      * @var integer
  210.      */
  211.     private $maxTerm;
  212.     /**
  213.      * Set minAvance
  214.      *
  215.      * @param integer $minAvance
  216.      *
  217.      * @return CreditProgram
  218.      */
  219.     public function setMinAvance($minAvance)
  220.     {
  221.         $this->minAvance $minAvance;
  222.         return $this;
  223.     }
  224.     /**
  225.      * Get minAvance
  226.      *
  227.      * @return integer
  228.      */
  229.     public function getMinAvance()
  230.     {
  231.         return $this->minAvance;
  232.     }
  233.     public function getMaxAvance()
  234.     {
  235.         return max(array_keys(json_decode($this->params,true)));
  236.     }
  237.     /**
  238.      * Set maxTerm
  239.      *
  240.      * @param integer $maxTerm
  241.      *
  242.      * @return CreditProgram
  243.      */
  244.     public function setMaxTerm($maxTerm)
  245.     {
  246.         $this->maxTerm $maxTerm;
  247.         return $this;
  248.     }
  249.     /**
  250.      * Get maxTerm
  251.      *
  252.      * @return integer
  253.      */
  254.     public function getMaxTerm()
  255.     {
  256.         return $this->maxTerm;
  257.     }
  258.     /**
  259.      * @var integer
  260.      */
  261.     private $maxAmount;
  262.     /**
  263.      * Set maxAmount
  264.      *
  265.      * @param integer $maxAmount
  266.      *
  267.      * @return CreditProgram
  268.      */
  269.     public function setMaxAmount($maxAmount)
  270.     {
  271.         $this->maxAmount $maxAmount;
  272.         return $this;
  273.     }
  274.     /**
  275.      * Get maxAmount
  276.      *
  277.      * @return integer
  278.      */
  279.     public function getMaxAmount()
  280.     {
  281.         return $this->maxAmount;
  282.     }
  283.     /**
  284.      * @var Vehicle
  285.      */
  286.     private $vehicle;
  287.     /**
  288.      * Set vehicle
  289.      *
  290.      * @param Vehicle $vehicle
  291.      *
  292.      * @return CreditProgram
  293.      */
  294.     public function setVehicle(Vehicle $vehicle null)
  295.     {
  296.         $this->vehicle $vehicle;
  297.         return $this;
  298.     }
  299.     /**
  300.      * Get vehicle
  301.      *
  302.      * @return Vehicle
  303.      */
  304.     public function getVehicle()
  305.     {
  306.         return $this->vehicle;
  307.     }
  308.     /**
  309.      * @var float
  310.      */
  311.     private $addit_payment;
  312.     /**
  313.      * @var string
  314.      */
  315.     private $addit_payment_comment;
  316.     /**
  317.      * @var float
  318.      */
  319.     private $go_amount;
  320.     /**
  321.      * @var string
  322.      */
  323.     private $casco_payment;
  324.     /**
  325.      * @var Collection
  326.      */
  327.     private $vehicles;
  328.     /**
  329.      * Set additPayment
  330.      *
  331.      * @param float $additPayment
  332.      *
  333.      * @return CreditProgram
  334.      */
  335.     public function setAdditPayment($additPayment)
  336.     {
  337.         $this->addit_payment $additPayment;
  338.         return $this;
  339.     }
  340.     /**
  341.      * Get additPayment
  342.      *
  343.      * @return float
  344.      */
  345.     public function getAdditPayment()
  346.     {
  347.         return $this->addit_payment;
  348.     }
  349.     /**
  350.      * Set additPaymentComment
  351.      *
  352.      * @param string $additPaymentComment
  353.      *
  354.      * @return CreditProgram
  355.      */
  356.     public function setAdditPaymentComment($additPaymentComment)
  357.     {
  358.         $this->addit_payment_comment $additPaymentComment;
  359.         return $this;
  360.     }
  361.     /**
  362.      * Get additPaymentComment
  363.      *
  364.      * @return string
  365.      */
  366.     public function getAdditPaymentComment()
  367.     {
  368.         return $this->addit_payment_comment;
  369.     }
  370.     /**
  371.      * Set goAmount
  372.      *
  373.      * @param float $goAmount
  374.      *
  375.      * @return CreditProgram
  376.      */
  377.     public function setGoAmount($goAmount)
  378.     {
  379.         $this->go_amount $goAmount;
  380.         return $this;
  381.     }
  382.     /**
  383.      * Get goAmount
  384.      *
  385.      * @return float
  386.      */
  387.     public function getGoAmount()
  388.     {
  389.         return $this->go_amount;
  390.     }
  391.     /**
  392.      * Set cascoPayment
  393.      *
  394.      * @param string $cascoPayment
  395.      *
  396.      * @return CreditProgram
  397.      */
  398.     public function setCascoPayment($cascoPayment)
  399.     {
  400.         $this->casco_payment $cascoPayment;
  401.         return $this;
  402.     }
  403.     /**
  404.      * Get cascoPayment
  405.      *
  406.      * @return string
  407.      */
  408.     public function getCascoPayment()
  409.     {
  410.         return $this->casco_payment;
  411.     }
  412.     /**
  413.      * Add vehicle
  414.      *
  415.      * @param Vehicle $vehicle
  416.      *
  417.      * @return CreditProgram
  418.      */
  419.     public function addVehicle(Vehicle $vehicle)
  420.     {
  421.         $this->vehicles[] = $vehicle;
  422.         return $this;
  423.     }
  424.     /**
  425.      * Remove vehicle
  426.      *
  427.      * @param Vehicle $vehicle
  428.      */
  429.     public function removeVehicle(Vehicle $vehicle)
  430.     {
  431.         $this->vehicles->removeElement($vehicle);
  432.     }
  433.     /**
  434.      * Get vehicles
  435.      *
  436.      * @return Collection
  437.      */
  438.     public function getVehicles()
  439.     {
  440.         return $this->vehicles;
  441.     }
  442.     /**
  443.      * @var float
  444.      */
  445.     private $casco_payment_0;
  446.     /**
  447.      * @var float
  448.      */
  449.     private $casco_payment_05;
  450.     /**
  451.      * @var float
  452.      */
  453.     private $casco_payment_1;
  454.     /**
  455.      * Set cascoPayment0
  456.      *
  457.      * @param float $cascoPayment0
  458.      *
  459.      * @return CreditProgram
  460.      */
  461.     public function setCascoPayment0($cascoPayment0)
  462.     {
  463.         $this->casco_payment_0 $cascoPayment0;
  464.         return $this;
  465.     }
  466.     /**
  467.      * Get cascoPayment0
  468.      *
  469.      * @return float
  470.      */
  471.     public function getCascoPayment0()
  472.     {
  473.         return $this->casco_payment_0;
  474.     }
  475.     /**
  476.      * Set cascoPayment05
  477.      *
  478.      * @param float $cascoPayment05
  479.      *
  480.      * @return CreditProgram
  481.      */
  482.     public function setCascoPayment05($cascoPayment05)
  483.     {
  484.         $this->casco_payment_05 $cascoPayment05;
  485.         return $this;
  486.     }
  487.     /**
  488.      * Get cascoPayment05
  489.      *
  490.      * @return float
  491.      */
  492.     public function getCascoPayment05()
  493.     {
  494.         return $this->casco_payment_05;
  495.     }
  496.     /**
  497.      * Set cascoPayment1
  498.      *
  499.      * @param float $cascoPayment1
  500.      *
  501.      * @return CreditProgram
  502.      */
  503.     public function setCascoPayment1($cascoPayment1)
  504.     {
  505.         $this->casco_payment_1 $cascoPayment1;
  506.         return $this;
  507.     }
  508.     /**
  509.      * Get cascoPayment1
  510.      *
  511.      * @return float
  512.      */
  513.     public function getCascoPayment1()
  514.     {
  515.         return $this->casco_payment_1;
  516.     }
  517.     public function getCasco(): array
  518.     {
  519.         $arr = [];
  520.         if ($this->casco_payment_0) {
  521.             $arr['0'] = $this->casco_payment_0;
  522.         }
  523.         if ($this->casco_payment_05) {
  524.             $arr['0.5'] = $this->casco_payment_05;
  525.         }
  526.         if ($this->casco_payment_1) {
  527.             $arr['1'] = $this->casco_payment_1;
  528.         }
  529.         return $arr;
  530.     }
  531.     public function getMaxCasco(): array
  532.     {
  533.         $casco = [];
  534.         if ($this->casco_payment_1) {
  535.             $casco['1'] = $this->casco_payment_1;
  536.         } elseif ($this->casco_payment_05) {
  537.             $casco['0.5'] = $this->casco_payment_05;
  538.         } else {
  539.             $casco['0'] = $this->casco_payment_0;
  540.         }
  541.         return $casco;
  542.     }
  543.     /**
  544.      * @var int|null
  545.      */
  546.     private $for_used;
  547.     /**
  548.      * Set forUsed.
  549.      *
  550.      * @param int|null $forUsed
  551.      *
  552.      * @return CreditProgram
  553.      */
  554.     public function setForUsed($forUsed null)
  555.     {
  556.         $this->for_used $forUsed;
  557.         return $this;
  558.     }
  559.     /**
  560.      * Get forUsed.
  561.      *
  562.      * @return int|null
  563.      */
  564.     public function getForUsed()
  565.     {
  566.         return $this->for_used 0;
  567.     }
  568. }