<?php
namespace App\AppBundle\MainBundle\Entity;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
use Symfony\Component\Validator\Constraints as Assert;
/**
* AddOns
*
* @ORM\Entity(repositoryClass="App\AppBundle\MainBundle\Repository\Orders_Suppliers_Transfer_ChargeRepository")
* @ORM\Table(name="orders_suppliers_transfer_charge")
* @ORM\HasLifecycleCallbacks()
*/
class Orders_Suppliers_Transfer_Charge implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var Orders_Suppliers_Transfers_Payout
* @ORM\ManyToOne(targetEntity="Orders_Suppliers_Transfers_Payout", inversedBy="order_supplier_transfers_charges")
* @ORM\JoinColumn(name="order_supplier_transfers_payout_id", referencedColumnName="id", nullable=true)
*/
private $orders_suppliers_transfers_payout;
/**
* @var User
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="supplier_id", referencedColumnName="id")
*/
private $supplier;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
* @Assert\NotBlank()
*/
private $amount;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $currency;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $comment;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $status;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $type;//0 - Manual Payout
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank()
*/
private $stripe_charge_id;
/**
* @var DateTime
* @ORM\Column(type="datetime", nullable=true)
* @Assert\NotBlank()
*/
private $processed_date;
/**
* @ORM\Column(type="boolean", nullable=false, options={"default" : 0})
* @Assert\NotBlank()
*/
private $hold = false;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return Orders_Suppliers_Transfers_Payout
*/
public function getOrdersSuppliersTransfersPayout()
{
return $this->orders_suppliers_transfers_payout;
}
/**
* @param Orders_Suppliers_Transfers_Payout $orders_suppliers_transfers_payout
*/
public function setOrdersSuppliersTransfersPayout($orders_suppliers_transfers_payout)
{
$this->orders_suppliers_transfers_payout = $orders_suppliers_transfers_payout;
}
/**
* @return mixed
*/
public function getAmount()
{
return $this->amount;
}
/**
* @param mixed $amount
*/
public function setAmount($amount)
{
$this->amount = $amount;
}
/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}
/**
* @param mixed $comment
*/
public function setComment($comment)
{
$this->comment = $comment;
}
/**
* @return mixed
*/
public function getStatus()
{
return $this->status;
}
/**
* @param mixed $status
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* @return mixed
*/
public function getType()
{
return $this->type;
}
/**
* @param mixed $type
*/
public function setType($type)
{
$this->type = $type;
}
/**
* @return mixed
*/
public function getStripeChargeId()
{
return $this->stripe_charge_id;
}
/**
* @param mixed $stripe_charge_id
*/
public function setStripeChargeId($stripe_charge_id)
{
$this->stripe_charge_id = $stripe_charge_id;
}
/**
* @return DateTime
*/
public function getProcessedDate()
{
return $this->processed_date;
}
/**
* @param DateTime $processed_date
*/
public function setProcessedDate($processed_date)
{
$this->processed_date = $processed_date;
}
/**
* @return mixed
*/
public function getHold()
{
return $this->hold;
}
/**
* @param mixed $hold
*/
public function setHold($hold)
{
$this->hold = $hold;
}
/**
* @return User
*/
public function getSupplier()
{
return $this->supplier;
}
/**
* @param User $supplier
*/
public function setSupplier($supplier)
{
$this->supplier = $supplier;
}
/**
* @return mixed
*/
public function getCurrency()
{
return $this->currency;
}
/**
* @param mixed $currency
*/
public function setCurrency($currency)
{
$this->currency = $currency;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'supplier_id' => $this->supplier->getId(),
'currency' => $this->currency,
'amount' => $this->amount,
'comment' => $this->comment,
'status' => $this->status,
'type' => $this->type,
'hold' => $this->hold,
'stripe_charge_id' => $this->stripe_charge_id,
'processed_date' => $this->processed_date->format('Y-m-d H:i:s'),
'created' => $this->createdAt->format('Y-m-d H:i:s'),
'updated' => $this->updatedAt->format('Y-m-d H:i:s'),
);
}
/**
* @var DateTime $created
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $createdAt;
/**
* @var DateTime $updated
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $updatedAt;
/**
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAt()
{
$this->createdAt = new DateTime();
$this->updatedAt = new DateTime();
return $this;
}
/**
* @ORM\PreUpdate
*/
public function setUpdatedAtValue() {
$this->updatedAt = new DateTime();
}
public function __construct() {
}
}