<?php
namespace App\Entity;
use Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface;
use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait;
use Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait;
use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait;
use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @Doctrine\ORM\Mapping\Entity
* @Doctrine\ORM\Mapping\Table(name="payment_method")
*/
class PaymentMethod implements TranslatableInterface, BlameableInterface, TimestampableInterface, SoftDeletableInterface {
use BlameableTrait;
use TimestampableTrait;
use TranslatableTrait;
use SoftDeletableTrait;
const PAYMENT_METHOD_TYPE_PAYPAL = 'paypal';
const PAYMENT_METHOD_TYPE_ONLINE = 'online';
const PAYMENT_METHOD_TYPE_CASH = 'cash';
const PAYMENT_METHOD_TYPE_PERSONAL = 'personal';
/**
* @Doctrine\ORM\Mapping\Id
* @Doctrine\ORM\Mapping\Column(type="integer")
* @Doctrine\ORM\Mapping\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @Doctrine\ORM\Mapping\OneToMany(targetEntity="App\Entity\PaymentMethodPrice", mappedBy="paymentMethod", cascade={"persist"})
*/
protected $prices;
/**
* @Doctrine\ORM\Mapping\Column(type="string", length=255, nullable=false)
*/
protected $paymentType;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\EmailTemplate", cascade={"all"})
* @ORM\JoinColumn(name="confirmation_email", referencedColumnName="id", onDelete="CASCADE")
*/
protected $confirmationEmail;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\OrderStatus", cascade={"all"})
* @ORM\JoinColumn(name="order_status_id", referencedColumnName="id", onDelete="CASCADE")
*/
protected $status;
/**
** @Doctrine\ORM\Mapping\ManyToOne(targetEntity="App\Entity\ProductVat", cascade={"all"})
** @Doctrine\ORM\Mapping\JoinColumn(name="vat_id", referencedColumnName="id", onDelete="CASCADE")
*/
protected $vat;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\EmailTemplate", cascade={"all"})
* @ORM\JoinColumn(name="sent_order_email", referencedColumnName="id", onDelete="CASCADE")
*/
protected $sentOrderEmail;
static public function getTypes() {
return [
self::PAYMENT_METHOD_TYPE_CASH => self::PAYMENT_METHOD_TYPE_CASH,
self::PAYMENT_METHOD_TYPE_ONLINE => self::PAYMENT_METHOD_TYPE_ONLINE,
self::PAYMENT_METHOD_TYPE_PERSONAL => self::PAYMENT_METHOD_TYPE_PERSONAL,
self::PAYMENT_METHOD_TYPE_PAYPAL => self::PAYMENT_METHOD_TYPE_PAYPAL
];
}
/**
* Obsługa tłumaczeń
* @param $method
* @param $arguments
* @return mixed
*/
public function __call($method, $arguments)
{
return $this->proxyCurrentLocaleTranslation($method, $arguments);
}
public function getName(){
return $this->translate()->getName();
}
public function getContent(){
return $this->translate()->getContent();
}
public function getDescription(){
return $this->translate()->getDescription();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Constructor
*/
public function __construct()
{
$this->prices = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add price
*
* @param \App\Entity\PaymentMethodPrice $price
*
* @return PaymentMethod
*/
public function addPrice(\App\Entity\PaymentMethodPrice $price)
{
$this->prices[] = $price;
return $this;
}
/**
* Remove price
*
* @param \App\Entity\PaymentMethodPrice $price
*/
public function removePrice(\App\Entity\PaymentMethodPrice $price)
{
$this->prices->removeElement($price);
}
/**
* Get prices
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPrices()
{
return $this->prices;
}
/**
* Set paymentType
*
* @param string $paymentType
*
* @return PaymentMethod
*/
public function setPaymentType($paymentType)
{
$this->paymentType = $paymentType;
return $this;
}
/**
* Get paymentType
*
* @return string
*/
public function getPaymentType()
{
return $this->paymentType;
}
/**
* Set confirmationEmail
*
* @param \App\Entity\EmailTemplate $confirmationEmail
*
* @return PaymentMethod
*/
public function setConfirmationEmail(\App\Entity\EmailTemplate $confirmationEmail = null)
{
$this->confirmationEmail = $confirmationEmail;
return $this;
}
/**
* Get confirmationEmail
*
* @return \App\Entity\EmailTemplate
*/
public function getConfirmationEmail()
{
return $this->confirmationEmail;
}
/**
* Set sentOrderEmail
*
* @param \App\Entity\EmailTemplate $sentOrderEmail
*
* @return PaymentMethod
*/
public function setSentOrderEmail(\App\Entity\EmailTemplate $sentOrderEmail = null)
{
$this->sentOrderEmail = $sentOrderEmail;
return $this;
}
/**
* Get sentOrderEmail
*
* @return \App\Entity\EmailTemplate
*/
public function getSentOrderEmail()
{
return $this->sentOrderEmail;
}
/**
* Set status
*
* @param \App\Entity\OrderStatus $status
*
* @return PaymentMethod
*/
public function setStatus(\App\Entity\OrderStatus $status = null)
{
$this->status = $status;
return $this;
}
/**
* Get status
*
* @return \App\Entity\OrderStatus
*/
public function getStatus()
{
return $this->status;
}
/**
* Set vat
*
* @param \App\Entity\ProductVat $vat
*
* @return PaymentMethod
*/
public function setVat(\App\Entity\ProductVat $vat = null)
{
$this->vat = $vat;
return $this;
}
/**
* Get vat
*
* @return \App\Entity\ProductVat
*/
public function getVat()
{
return $this->vat;
}
}