vendor/bluue/sales-bundle/src/Entity/Bank.php line 36

Open in your IDE?
  1. <?php
  2. /**
  3.  * @author Leo BANNHOLTZER (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 App\DoctrineExtensions\IsActiveEntity;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Symfony\Component\Uid\Uuid;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Gedmo\Mapping\Annotation as Gedmo;
  15. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  16. use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
  17. use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
  18. use Bluue\SalesBundle\Repository\BankRepository;
  19. /**
  20.  * @ORM\Entity(repositoryClass=BankRepository::class)
  21.  * @ORM\Table(name="sales_bundle__bank", indexes={
  22.  *  @ORM\Index(name="name", columns={"name"}),
  23.  *  @ORM\Index(name="account_number", columns={"account_number"}),
  24.  *  @ORM\Index(name="is_active", columns={"is_active"}),
  25.  *  @ORM\Index(name="deleted_at", columns={"deleted_at"}),
  26.  *  @ORM\Index(name="created_at", columns={"created_at"}),
  27.  *  @ORM\Index(name="updated_at", columns={"updated_at"})
  28.  * })
  29.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
  30.  */
  31. class Bank
  32. {
  33.     use UserTimestampableEntity;
  34.     use UserSoftDeleteableEntity;
  35.     use IsActiveEntity;
  36.     /**
  37.      * @ORM\Id
  38.      * @ORM\Column(type="uuid")
  39.      * @ORM\GeneratedValue(strategy="CUSTOM")
  40.      * @ORM\CustomIdGenerator(class=UuidGenerator::class)
  41.      */
  42.     private ?Uuid $id null;
  43.     /**
  44.      * @ORM\Column(type="string", length=255)
  45.      */
  46.     private string $name;
  47.     /**
  48.      * @ORM\Column(type="string", length=32, nullable=true)
  49.      */
  50.     private ?string $accountNumber;
  51.     /**
  52.      * @ORM\OneToMany(targetEntity=PaymentMethod::class, mappedBy="bank")
  53.      * @ORM\JoinColumn(nullable=true)
  54.      */
  55.     private Collection $paymentMethods;
  56.     public function __construct()
  57.     {
  58.         $this->paymentMethods = new ArrayCollection();
  59.     }
  60.     /**
  61.      * @return Uuid|null
  62.      */
  63.     public function getId(): ?Uuid
  64.     {
  65.         return $this->id;
  66.     }
  67.     /**
  68.      * @return string
  69.      */
  70.     public function getName(): string
  71.     {
  72.         return $this->name;
  73.     }
  74.     /**
  75.      * @param string $name
  76.      * @return $this
  77.      */
  78.     public function setName(string $name): self
  79.     {
  80.         $this->name $name;
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return string|null
  85.      */
  86.     public function getAccountNumber(): ?string
  87.     {
  88.         return $this->accountNumber;
  89.     }
  90.     /**
  91.      * @param string|null $accountNumber
  92.      * @return $this
  93.      */
  94.     public function setAccountNumber(?string $accountNumber): self
  95.     {
  96.         $this->accountNumber $accountNumber;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection
  101.      */
  102.     public function getPaymentMethods(): Collection
  103.     {
  104.         return $this->paymentMethods;
  105.     }
  106.     /**
  107.      * @param PaymentMethod $paymentMethod
  108.      * @return $this
  109.      */
  110.     public function addPaymentMethod(PaymentMethod $paymentMethod): self
  111.     {
  112.         if (!$this->paymentMethods->contains($paymentMethod)) {
  113.             $this->paymentMethods[] = $paymentMethod;
  114.             $paymentMethod->setBank($this);
  115.         }
  116.         return $this;
  117.     }
  118. }