src/Entity/PaymentMethod.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface;
  4. use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait;
  5. use Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait;
  6. use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
  7. use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait;
  8. use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;
  9. use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
  10. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\ORM\Mapping as ORM;
  14. /**
  15.  * @Doctrine\ORM\Mapping\Entity
  16.  * @Doctrine\ORM\Mapping\Table(name="payment_method")
  17.  */
  18. class PaymentMethod implements TranslatableInterfaceBlameableInterfaceTimestampableInterfaceSoftDeletableInterface  {
  19.     use BlameableTrait;
  20.     use TimestampableTrait;
  21.     use TranslatableTrait;
  22.     use SoftDeletableTrait;
  23.     
  24.     
  25.     
  26.     const PAYMENT_METHOD_TYPE_PAYPAL 'paypal';
  27.     const PAYMENT_METHOD_TYPE_ONLINE 'online';
  28.     const PAYMENT_METHOD_TYPE_CASH 'cash';
  29.     const PAYMENT_METHOD_TYPE_PERSONAL 'personal';
  30.     /**
  31.      * @Doctrine\ORM\Mapping\Id
  32.      * @Doctrine\ORM\Mapping\Column(type="integer")
  33.      * @Doctrine\ORM\Mapping\GeneratedValue(strategy="AUTO")
  34.      */
  35.     protected $id;
  36.     /**
  37.      * @Doctrine\ORM\Mapping\OneToMany(targetEntity="App\Entity\PaymentMethodPrice", mappedBy="paymentMethod", cascade={"persist"})
  38.      */
  39.     protected $prices;
  40.     /**
  41.      * @Doctrine\ORM\Mapping\Column(type="string", length=255, nullable=false)
  42.      */
  43.     protected $paymentType;
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity="App\Entity\EmailTemplate", cascade={"all"})
  46.      * @ORM\JoinColumn(name="confirmation_email", referencedColumnName="id", onDelete="CASCADE")
  47.      */
  48.     protected $confirmationEmail;
  49.     /**
  50.      * @ORM\ManyToOne(targetEntity="App\Entity\OrderStatus", cascade={"all"})
  51.      * @ORM\JoinColumn(name="order_status_id", referencedColumnName="id", onDelete="CASCADE")
  52.      */
  53.     protected $status;
  54.     /**
  55.      ** @Doctrine\ORM\Mapping\ManyToOne(targetEntity="App\Entity\ProductVat", cascade={"all"})
  56.      ** @Doctrine\ORM\Mapping\JoinColumn(name="vat_id", referencedColumnName="id", onDelete="CASCADE")
  57.      */
  58.     protected $vat;
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity="App\Entity\EmailTemplate", cascade={"all"})
  61.      * @ORM\JoinColumn(name="sent_order_email", referencedColumnName="id", onDelete="CASCADE")
  62.      */
  63.     protected $sentOrderEmail;
  64.     static public function getTypes() {
  65.         return [
  66.             self::PAYMENT_METHOD_TYPE_CASH => self::PAYMENT_METHOD_TYPE_CASH,
  67.             self::PAYMENT_METHOD_TYPE_ONLINE => self::PAYMENT_METHOD_TYPE_ONLINE,
  68.             self::PAYMENT_METHOD_TYPE_PERSONAL => self::PAYMENT_METHOD_TYPE_PERSONAL,
  69.             self::PAYMENT_METHOD_TYPE_PAYPAL => self::PAYMENT_METHOD_TYPE_PAYPAL
  70.         ];
  71.     }
  72.     /**
  73.      * Obsługa tłumaczeń
  74.      * @param $method
  75.      * @param $arguments
  76.      * @return mixed
  77.      */
  78.     public function __call($method$arguments)
  79.     {
  80.         return $this->proxyCurrentLocaleTranslation($method$arguments);
  81.     }
  82.     public function getName(){
  83.         return $this->translate()->getName();
  84.     }
  85.     public function getContent(){
  86.         return $this->translate()->getContent();
  87.     }
  88.     public function getDescription(){
  89.         return $this->translate()->getDescription();
  90.     }
  91.     /**
  92.      * Get id
  93.      *
  94.      * @return integer
  95.      */
  96.     public function getId()
  97.     {
  98.         return $this->id;
  99.     }
  100.     /**
  101.      * Constructor
  102.      */
  103.     public function __construct()
  104.     {
  105.         $this->prices = new \Doctrine\Common\Collections\ArrayCollection();
  106.     }
  107.     /**
  108.      * Add price
  109.      *
  110.      * @param \App\Entity\PaymentMethodPrice $price
  111.      *
  112.      * @return PaymentMethod
  113.      */
  114.     public function addPrice(\App\Entity\PaymentMethodPrice $price)
  115.     {
  116.         $this->prices[] = $price;
  117.         return $this;
  118.     }
  119.     /**
  120.      * Remove price
  121.      *
  122.      * @param \App\Entity\PaymentMethodPrice $price
  123.      */
  124.     public function removePrice(\App\Entity\PaymentMethodPrice $price)
  125.     {
  126.         $this->prices->removeElement($price);
  127.     }
  128.     /**
  129.      * Get prices
  130.      *
  131.      * @return \Doctrine\Common\Collections\Collection
  132.      */
  133.     public function getPrices()
  134.     {
  135.         return $this->prices;
  136.     }
  137.     /**
  138.      * Set paymentType
  139.      *
  140.      * @param string $paymentType
  141.      *
  142.      * @return PaymentMethod
  143.      */
  144.     public function setPaymentType($paymentType)
  145.     {
  146.         $this->paymentType $paymentType;
  147.         return $this;
  148.     }
  149.     /**
  150.      * Get paymentType
  151.      *
  152.      * @return string
  153.      */
  154.     public function getPaymentType()
  155.     {
  156.         return $this->paymentType;
  157.     }
  158.     /**
  159.      * Set confirmationEmail
  160.      *
  161.      * @param \App\Entity\EmailTemplate $confirmationEmail
  162.      *
  163.      * @return PaymentMethod
  164.      */
  165.     public function setConfirmationEmail(\App\Entity\EmailTemplate $confirmationEmail null)
  166.     {
  167.         $this->confirmationEmail $confirmationEmail;
  168.         return $this;
  169.     }
  170.     /**
  171.      * Get confirmationEmail
  172.      *
  173.      * @return \App\Entity\EmailTemplate
  174.      */
  175.     public function getConfirmationEmail()
  176.     {
  177.         return $this->confirmationEmail;
  178.     }
  179.     /**
  180.      * Set sentOrderEmail
  181.      *
  182.      * @param \App\Entity\EmailTemplate $sentOrderEmail
  183.      *
  184.      * @return PaymentMethod
  185.      */
  186.     public function setSentOrderEmail(\App\Entity\EmailTemplate $sentOrderEmail null)
  187.     {
  188.         $this->sentOrderEmail $sentOrderEmail;
  189.         return $this;
  190.     }
  191.     /**
  192.      * Get sentOrderEmail
  193.      *
  194.      * @return \App\Entity\EmailTemplate
  195.      */
  196.     public function getSentOrderEmail()
  197.     {
  198.         return $this->sentOrderEmail;
  199.     }
  200.     /**
  201.      * Set status
  202.      *
  203.      * @param \App\Entity\OrderStatus $status
  204.      *
  205.      * @return PaymentMethod
  206.      */
  207.     public function setStatus(\App\Entity\OrderStatus $status null)
  208.     {
  209.         $this->status $status;
  210.         return $this;
  211.     }
  212.     /**
  213.      * Get status
  214.      *
  215.      * @return \App\Entity\OrderStatus
  216.      */
  217.     public function getStatus()
  218.     {
  219.         return $this->status;
  220.     }
  221.     /**
  222.      * Set vat
  223.      *
  224.      * @param \App\Entity\ProductVat $vat
  225.      *
  226.      * @return PaymentMethod
  227.      */
  228.     public function setVat(\App\Entity\ProductVat $vat null)
  229.     {
  230.         $this->vat $vat;
  231.         return $this;
  232.     }
  233.     /**
  234.      * Get vat
  235.      *
  236.      * @return \App\Entity\ProductVat
  237.      */
  238.     public function getVat()
  239.     {
  240.         return $this->vat;
  241.     }
  242. }