src/AppBundle/MainBundle/Entity/Orders_Suppliers_Transfers_Payout.php line 631

Open in your IDE?
  1. <?php
  2. namespace App\AppBundle\MainBundle\Entity;
  3. use DateTime;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use JsonSerializable;
  7. use PetstoreIO\Order;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * AddOns
  11.  *
  12.  * @ORM\Entity(repositoryClass="App\AppBundle\MainBundle\Repository\Orders_Suppliers_Transfers_PayoutRepository")
  13.  * @ORM\Table(name="orders_suppliers_transfers_payout")
  14.  * @ORM\HasLifecycleCallbacks()
  15.  */
  16. class Orders_Suppliers_Transfers_Payout implements JsonSerializable
  17. {
  18.     /**
  19.      * @ORM\Column(type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\Column(type="string", nullable=true)
  26.      */
  27.     private $reference_id;
  28.     /**
  29.      * @var ArrayCollection
  30.      * @ORM\OneToMany(targetEntity="Orders_Suppliers_Transfer", mappedBy="orders_suppliers_transfers_payout")
  31.      */
  32.     private $order_supplier_transfers;
  33.     /**
  34.      * @var ArrayCollection
  35.      * @ORM\OneToMany(targetEntity="Orders_Suppliers_Transfer_Charge", mappedBy="orders_suppliers_transfers_payout")
  36.      */
  37.     private $order_supplier_transfers_charges;
  38.     /**
  39.      * @var ArrayCollection
  40.      * @ORM\OneToMany(targetEntity="Orders_Suppliers_Transfers_Payout_Status", mappedBy="order_supplier_transfer_payout")
  41.      */
  42.     private $order_supplier_transfers_payout_status;
  43.     /**
  44.      * @var User
  45.      * @ORM\ManyToOne(targetEntity="User")
  46.      * @ORM\JoinColumn(name="supplier_id", referencedColumnName="id")
  47.      */
  48.     private $supplier;
  49.     /**
  50.      * @var ArrayCollection
  51.      * @ORM\ManyToMany(targetEntity="PS_Add_Spot")
  52.      * @ORM\JoinTable(name="orders_suppliers_transfers_payout_spots",
  53.      *      joinColumns={@ORM\JoinColumn(name="orders_suppliers_transfers_payout_id", referencedColumnName="id")},
  54.      *      inverseJoinColumns={@ORM\JoinColumn(name="add_spot_id", referencedColumnName="id")}
  55.      *      )
  56.      */
  57.     private $add_spots;
  58.     /**
  59.      * @ORM\Column(type="decimal", precision=10, scale=2)
  60.      */
  61.     private $amount;//This is net earnings
  62.     /**
  63.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  64.      */
  65.     private $total_amount 0;
  66.     /**
  67.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  68.      */
  69.     private $commission_fees 0;
  70.     /**
  71.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  72.      */
  73.     private $vat 0;
  74.     /**
  75.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  76.      */
  77.     private $charges_amount 0;
  78.     /**
  79.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  80.      */
  81.     private $service_fee 0;
  82.     /**
  83.      * @ORM\Column(type="string", nullable=false)
  84.      */
  85.     private $currency_symbol;
  86.     /**
  87.      * @ORM\Column(type="string", nullable=false)
  88.      */
  89.     private $currency_code;
  90.     /**
  91.      * @ORM\Column(type="string", nullable=true)
  92.      */
  93.     private $comment;
  94.     /**
  95.      * @ORM\Column(type="string", nullable=true)
  96.      * @Assert\NotBlank()
  97.      */
  98.     private $status;//BookingStatus Constants for Refund Status
  99.     /**
  100.      * @ORM\Column(type="string", nullable=true)
  101.      * @Assert\NotBlank()
  102.      */
  103.     private $stripe_id;
  104.     /**
  105.      * @var DateTime
  106.      * @ORM\Column(type="datetime", nullable=true)
  107.      * @Assert\NotBlank()
  108.      */
  109.     private $processed_date;
  110.     /**
  111.      * @var DateTime
  112.      * @ORM\Column(type="datetime", nullable=true)
  113.      * @Assert\NotBlank()
  114.      */
  115.     private $start_date;
  116.     /**
  117.      * @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
  118.      * @Assert\NotBlank()
  119.      */
  120.     private $hold_transfer false;
  121.     /**
  122.      * @var DateTime
  123.      * @ORM\Column(type="datetime", nullable=true)
  124.      */
  125.     private $arrival_date;
  126.     /**
  127.      * @ORM\Column(type="string", nullable=false)
  128.      */
  129.     private $stripe_currency 'chf';
  130.     /**
  131.      * @ORM\Column(type="string", length = 1000, nullable=true)
  132.      */
  133.     private $invoice;
  134.     /**
  135.      * @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
  136.      */
  137.     private $is_auto_payout false;
  138.     /**
  139.      * @return mixed
  140.      */
  141.     public function getId()
  142.     {
  143.         return $this->id;
  144.     }
  145.     /**
  146.      * @return ArrayCollection
  147.      */
  148.     public function getOrderSupplierTransfers()
  149.     {
  150.         return $this->order_supplier_transfers;
  151.     }
  152.     /**
  153.      * @param ArrayCollection $order_supplier_transfers
  154.      */
  155.     public function setOrderSupplierTransfers($order_supplier_transfers)
  156.     {
  157.         $this->order_supplier_transfers $order_supplier_transfers;
  158.     }
  159.     /**
  160.      * @return ArrayCollection
  161.      */
  162.     public function getOrderSupplierTransfersPayoutStatus()
  163.     {
  164.         return $this->order_supplier_transfers_payout_status;
  165.     }
  166.     /**
  167.      * @param ArrayCollection $order_supplier_transfers_payout_status
  168.      */
  169.     public function setOrderSupplierTransfersPayoutStatus($order_supplier_transfers_payout_status)
  170.     {
  171.         $this->order_supplier_transfers_payout_status $order_supplier_transfers_payout_status;
  172.     }
  173.     /**
  174.      * @return mixed
  175.      */
  176.     public function getAmount()
  177.     {
  178.         return $this->amount;
  179.     }
  180.     /**
  181.      * @param mixed $amount
  182.      */
  183.     public function setAmount($amount)
  184.     {
  185.         $this->amount $amount;
  186.     }
  187.     /**
  188.      * @return mixed
  189.      */
  190.     public function getComment()
  191.     {
  192.         return $this->comment;
  193.     }
  194.     /**
  195.      * @param mixed $comment
  196.      */
  197.     public function setComment($comment)
  198.     {
  199.         $this->comment $comment;
  200.     }
  201.     /**
  202.      * @return mixed
  203.      */
  204.     public function getStatus()
  205.     {
  206.         return $this->status;
  207.     }
  208.     /**
  209.      * @param mixed $status
  210.      */
  211.     public function setStatus($status)
  212.     {
  213.         $this->status $status;
  214.     }
  215.     /**
  216.      * @return mixed
  217.      */
  218.     public function getStripeId()
  219.     {
  220.         return $this->stripe_id;
  221.     }
  222.     /**
  223.      * @param mixed $stripe_id
  224.      */
  225.     public function setStripeId($stripe_id)
  226.     {
  227.         $this->stripe_id $stripe_id;
  228.     }
  229.     /**
  230.      * @return DateTime
  231.      */
  232.     public function getProcessedDate()
  233.     {
  234.         return $this->processed_date;
  235.     }
  236.     /**
  237.      * @param DateTime $processed_date
  238.      */
  239.     public function setProcessedDate(DateTime $processed_date)
  240.     {
  241.         $this->processed_date $processed_date;
  242.     }
  243.     /**
  244.      * @return DateTime
  245.      */
  246.     public function getStartDate()
  247.     {
  248.         return $this->start_date;
  249.     }
  250.     /**
  251.      * @param DateTime $start_date
  252.      */
  253.     public function setStartDate(DateTime $start_date)
  254.     {
  255.         $this->start_date $start_date;
  256.     }
  257.     /**
  258.      * @return mixed
  259.      */
  260.     public function getHoldTransfer()
  261.     {
  262.         return $this->hold_transfer;
  263.     }
  264.     /**
  265.      * @param mixed $hold_transfer
  266.      */
  267.     public function setHoldTransfer($hold_transfer)
  268.     {
  269.         $this->hold_transfer $hold_transfer;
  270.     }
  271.     /**
  272.      * @return mixed
  273.      */
  274.     public function getCurrencySymbol()
  275.     {
  276.         return $this->currency_symbol;
  277.     }
  278.     /**
  279.      * @param mixed $currency_symbol
  280.      */
  281.     public function setCurrencySymbol($currency_symbol)
  282.     {
  283.         $this->currency_symbol $currency_symbol;
  284.     }
  285.     /**
  286.      * @return mixed
  287.      */
  288.     public function getCurrencyCode()
  289.     {
  290.         return $this->currency_code;
  291.     }
  292.     /**
  293.      * @param mixed $currency_code
  294.      */
  295.     public function setCurrencyCode($currency_code)
  296.     {
  297.         $this->currency_code $currency_code;
  298.     }
  299.     /**
  300.      * @return DateTime
  301.      */
  302.     public function getArrivalDate()
  303.     {
  304.         return $this->arrival_date;
  305.     }
  306.     /**
  307.      * @param DateTime $arrival_date
  308.      */
  309.     public function setArrivalDate(DateTime $arrival_date)
  310.     {
  311.         $this->arrival_date $arrival_date;
  312.     }
  313.     /**
  314.      * @return User
  315.      */
  316.     public function getSupplier()
  317.     {
  318.         return $this->supplier;
  319.     }
  320.     /**
  321.      * @param User $supplier
  322.      */
  323.     public function setSupplier(User $supplier)
  324.     {
  325.         $this->supplier $supplier;
  326.     }
  327.     /**
  328.      * @return ArrayCollection
  329.      */
  330.     public function getAddSpots()
  331.     {
  332.         return $this->add_spots;
  333.     }
  334.     /**
  335.      * @param mixed $add_spots
  336.      */
  337.     public function setAddSpots($add_spots)
  338.     {
  339.         $this->add_spots $add_spots;
  340.     }
  341.     /**
  342.      * @param PS_Add_Spot $add_Spot
  343.      *
  344.      * @return Orders_Suppliers_Transfers_Payout
  345.      */
  346.     public function addSpot(PS_Add_Spot $add_Spot)
  347.     {
  348.         if (!$this->add_spots->contains($add_Spot)) {
  349.             $this->add_spots->add($add_Spot);
  350.         }
  351.         return $this;
  352.     }
  353.     /**
  354.      * @param PS_Add_Spot $add_Spot
  355.      */
  356.     public function removeAddSpot(PS_Add_Spot $add_Spot)
  357.     {
  358.         $this->add_spots->removeElement($add_Spot);
  359.     }
  360.     /**
  361.      * @return mixed
  362.      */
  363.     public function getReferenceId()
  364.     {
  365.         return $this->reference_id;
  366.     }
  367.     /**
  368.      * @param mixed $reference_id
  369.      */
  370.     public function setReferenceId($reference_id)
  371.     {
  372.         $this->reference_id $reference_id;
  373.     }
  374.     /**
  375.      * @return ArrayCollection
  376.      */
  377.     public function getOrderSupplierTransfersCharges()
  378.     {
  379.         return $this->order_supplier_transfers_charges;
  380.     }
  381.     /**
  382.      * @param ArrayCollection $order_supplier_transfers_charges
  383.      */
  384.     public function setOrderSupplierTransfersCharges($order_supplier_transfers_charges)
  385.     {
  386.         $this->order_supplier_transfers_charges $order_supplier_transfers_charges;
  387.     }
  388.     /**
  389.      * @return mixed
  390.      */
  391.     public function getStripeCurrency()
  392.     {
  393.         return $this->stripe_currency;
  394.     }
  395.     /**
  396.      * @param mixed $stripe_currency
  397.      */
  398.     public function setStripeCurrency($stripe_currency)
  399.     {
  400.         $this->stripe_currency $stripe_currency;
  401.     }
  402.     /**
  403.      * @return mixed
  404.      */
  405.     public function getInvoice()
  406.     {
  407.         return $this->invoice;
  408.     }
  409.     /**
  410.      * @param mixed $invoice
  411.      */
  412.     public function setInvoice($invoice)
  413.     {
  414.         $this->invoice $invoice;
  415.     }
  416.     /**
  417.      * @return mixed
  418.      */
  419.     public function getIsAutoPayout()
  420.     {
  421.         return $this->is_auto_payout;
  422.     }
  423.     /**
  424.      * @param mixed $is_auto_payout
  425.      */
  426.     public function setIsAutoPayout($is_auto_payout)
  427.     {
  428.         $this->is_auto_payout $is_auto_payout;
  429.     }
  430.     /**
  431.      * @return mixed
  432.      */
  433.     public function getTotalAmount()
  434.     {
  435.         return $this->total_amount;
  436.     }
  437.     /**
  438.      * @param mixed $total_amount
  439.      */
  440.     public function setTotalAmount($total_amount)
  441.     {
  442.         $this->total_amount $total_amount;
  443.     }
  444.     /**
  445.      * @return mixed
  446.      */
  447.     public function getCommissionFees()
  448.     {
  449.         return $this->commission_fees;
  450.     }
  451.     /**
  452.      * @param mixed $commission_fees
  453.      */
  454.     public function setCommissionFees($commission_fees)
  455.     {
  456.         $this->commission_fees $commission_fees;
  457.     }
  458.     /**
  459.      * @return mixed
  460.      */
  461.     public function getChargesAmount()
  462.     {
  463.         return $this->charges_amount;
  464.     }
  465.     /**
  466.      * @param mixed $charges_amount
  467.      */
  468.     public function setChargesAmount($charges_amount)
  469.     {
  470.         $this->charges_amount $charges_amount;
  471.     }
  472.     /**
  473.      * @return mixed
  474.      */
  475.     public function getVat()
  476.     {
  477.         return $this->vat;
  478.     }
  479.     /**
  480.      * @param mixed $vat
  481.      */
  482.     public function setVat($vat)
  483.     {
  484.         $this->vat $vat;
  485.     }
  486.     /**
  487.      * @return mixed
  488.      */
  489.     public function getServiceFee()
  490.     {
  491.         return $this->service_fee;
  492.     }
  493.     /**
  494.      * @param mixed $service_fee
  495.      */
  496.     public function setServiceFee($service_fee)
  497.     {
  498.         $this->service_fee $service_fee;
  499.     }
  500.     public function jsonSerialize()
  501.     {
  502.         return array(
  503.             'id' => $this->id,
  504.             'reference_id' => $this->reference_id,
  505.             'supplier_id' => $this->getSupplier()->getId(),
  506.             'order_supplier_transfers' => $this->getOrderSupplierTransfers(),
  507.             'order_supplier_transfers_charges' => $this->getOrderSupplierTransfersCharges(),
  508.             'total_bookings' => count($this->getOrderSupplierTransfers()),
  509.             'amount' => $this->amount,
  510.             'total_amount' => $this->total_amount,
  511.             'commission_fees' => $this->commission_fees,
  512.             'charges_amount' => $this->charges_amount,
  513.             'service_fee' => $this->service_fee,
  514.             'vat' => $this->vat,
  515.             'currency_symbol' => $this->currency_symbol,
  516.             'currency_code' => $this->currency_code,
  517.             'comment' => $this->comment,
  518.             'status' => $this->status,
  519.             'is_auto_payout' => $this->is_auto_payout,
  520.             'stripe_id' => $this->stripe_id,
  521.             'hold_transfer' => $this->hold_transfer,
  522.             'processed_date' => $this->processed_date != NULL $this->processed_date->format('Y-m-d H:i:s') : NULL,
  523.             'start_date' => $this->start_date != NULL $this->start_date->format('Y-m-d H:i:s') : NULL,
  524.             'arrival_date' => $this->arrival_date != NULL $this->arrival_date->format('Y-m-d H:i:s') : NULL,
  525.             'created' => $this->createdAt->format('Y-m-d H:i:s'),
  526.             'updated' => $this->updatedAt->format('Y-m-d H:i:s'),
  527.             'order_supplier_transfers_payout_status' => $this->getOrderSupplierTransfersPayoutStatus(),
  528.             'stripe_currency' => $this->stripe_currency,
  529.             'invoice' => $this->invoice,
  530.         );
  531.     }
  532.     /**
  533.      * @var DateTime $created
  534.      *
  535.      * @ORM\Column(type="datetime", nullable=false)
  536.      */
  537.     protected $createdAt;
  538.     /**
  539.      * @var DateTime $updated
  540.      *
  541.      * @ORM\Column(type="datetime", nullable=false)
  542.      */
  543.     protected $updatedAt;
  544.     /**
  545.      * @return DateTime
  546.      */
  547.     public function getCreatedAt()
  548.     {
  549.         return $this->createdAt;
  550.     }
  551.     /**
  552.      * @return DateTime
  553.      */
  554.     public function getUpdatedAt()
  555.     {
  556.         return $this->updatedAt;
  557.     }
  558.     public function setUpdatedAt($updatedAt)
  559.     {
  560.         $this->updatedAt $updatedAt;
  561.         return $this;
  562.     }
  563.     /**
  564.      * @ORM\PrePersist
  565.      */
  566.     public function setCreatedAt()
  567.     {
  568.         $this->createdAt = new DateTime();
  569.         $this->updatedAt = new DateTime();
  570.         return $this;
  571.     }
  572.     /**
  573.      * @ORM\PreUpdate
  574.      */
  575.     public function setUpdatedAtValue()
  576.     {
  577.         $this->updatedAt = new DateTime();
  578.     }
  579.     public function __construct()
  580.     {
  581.         $this->add_spots = new ArrayCollection();
  582.         $this->order_supplier_transfers = new ArrayCollection();
  583.         $this->order_supplier_transfers_charges = new ArrayCollection();
  584.     }
  585. }