vendor/bluue/sales-bundle/src/Entity/PaymentMethod.php line 38

Open in your IDE?
  1. <?php
  2. /**
  3.  * @author Quentin CHATELAIN (contact@scaledev.fr)
  4.  * @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
  5.  * @license commercial
  6.  */
  7. declare(strict_types=1);
  8. namespace Bluue\SalesBundle\Entity;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\Uid\Uuid;
  13. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  14. use Gedmo\Mapping\Annotation as Gedmo;
  15. use Bluue\SalesBundle\Repository\PaymentMethodRepository;
  16. use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
  17. use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
  18. use App\DoctrineExtensions\IsActiveEntity;
  19. /**
  20.  * @ORM\Entity(repositoryClass=PaymentMethodRepository::class)
  21.  * @ORM\Table(name="sales_bundle__payment_method", indexes={
  22.  *  @ORM\Index(name="name", columns={"name"}),
  23.  *  @ORM\Index(name="is_invoice", columns={"is_invoice"}),
  24.  *  @ORM\Index(name="is_credit_note", columns={"is_credit_note"}),
  25.  *  @ORM\Index(name="is_active", columns={"is_active"}),
  26.  *  @ORM\Index(name="deleted_at", columns={"deleted_at"}),
  27.  *  @ORM\Index(name="created_at", columns={"created_at"}),
  28.  *  @ORM\Index(name="updated_at", columns={"updated_at"})
  29.  * })
  30.  * @Gedmo\TranslationEntity(class="Bluue\SalesBundle\Entity\PaymentMethodTranslation")
  31.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
  32.  */
  33. class PaymentMethod
  34. {
  35.     use UserTimestampableEntity;
  36.     use UserSoftDeleteableEntity;
  37.     use IsActiveEntity;
  38.     /**
  39.      * @ORM\Id
  40.      * @ORM\Column(type="uuid")
  41.      * @ORM\GeneratedValue(strategy="CUSTOM")
  42.      * @ORM\CustomIdGenerator(class=UuidGenerator::class)
  43.      */
  44.     private ?Uuid $id null;
  45.     /**
  46.      * @Gedmo\Translatable
  47.      * @ORM\Column(type="string", length=128)
  48.      */
  49.     private ?string $name null;
  50.     /**
  51.      * @ORM\Column(type="boolean")
  52.      */
  53.     private bool $is_invoice false;
  54.     /**
  55.      * @ORM\Column(type="boolean")
  56.      */
  57.     private bool $is_credit_note false;
  58.     /**
  59.      * @ORM\OneToMany(
  60.      *   targetEntity="PaymentMethodTranslation",
  61.      *   mappedBy="object",
  62.      *   cascade={"persist", "remove"},
  63.      *   fetch="EXTRA_LAZY"
  64.      * )
  65.      */
  66.     private Collection $translations;
  67.     /**
  68.      * @ORM\ManyToOne(targetEntity=Bank::class, inversedBy="paymentMethods")
  69.      * @ORM\JoinColumn(nullable=true)
  70.      */
  71.     private ?Bank $bank null;
  72.     public function __construct()
  73.     {
  74.         $this->translations = new ArrayCollection();
  75.     }
  76.     /**
  77.      * @return Uuid|null
  78.      */
  79.     public function getId(): ?Uuid
  80.     {
  81.         return $this->id;
  82.     }
  83.     /**
  84.      * @return string|null
  85.      */
  86.     public function getName(): ?string
  87.     {
  88.         return $this->name;
  89.     }
  90.     /**
  91.      * @return Collection|PaymentMethodTranslation[]
  92.      */
  93.     public function getTranslations(): Collection
  94.     {
  95.         return $this->translations;
  96.     }
  97.     /**
  98.      * @param string $name
  99.      * @return PaymentMethod
  100.      */
  101.     public function setName(string $name): self
  102.     {
  103.         $this->name $name;
  104.         return $this;
  105.     }
  106.     /**
  107.      * @return bool
  108.      */
  109.     public function isIsInvoice(): bool
  110.     {
  111.         return $this->is_invoice;
  112.     }
  113.     /**
  114.      * @param bool $is_invoice
  115.      * @return PaymentMethod
  116.      */
  117.     public function setIsInvoice(bool $is_invoice): self
  118.     {
  119.         $this->is_invoice $is_invoice;
  120.         return $this;
  121.     }
  122.     /**
  123.      * @return bool
  124.      */
  125.     public function isIsCreditNote(): bool
  126.     {
  127.         return $this->is_credit_note;
  128.     }
  129.     /**
  130.      * @param bool $is_credit_note
  131.      * @return PaymentMethod
  132.      */
  133.     public function setIsCreditNote(bool $is_credit_note): self
  134.     {
  135.         $this->is_credit_note $is_credit_note;
  136.         return $this;
  137.     }
  138.     /**
  139.      * @param PaymentMethodTranslation $t
  140.      * @return $this
  141.      */
  142.     public function addTranslation(PaymentMethodTranslation $t): self
  143.     {
  144.         if (!$this->translations->contains($t)) {
  145.             $this->translations[] = $t;
  146.             $t->setObject($this);
  147.         }
  148.         return $this;
  149.     }
  150.     /**
  151.      * @param Bank|null $bank
  152.      * @return $this
  153.      */
  154.     public function setBank(?Bank $bank): self
  155.     {
  156.         $this->bank $bank;
  157.         return $this;
  158.     }
  159.     /**
  160.      * @return Bank|null
  161.      */
  162.     public function getBank(): ?Bank
  163.     {
  164.         return $this->bank;
  165.     }
  166. }