<?php
/**
* @author Leo BANNHOLTZER (contact@scaledev.fr)
* @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
* @license commercial
*/
declare(strict_types=1);
namespace Bluue\SalesBundle\Entity;
use App\DoctrineExtensions\IsActiveEntity;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Uid\Uuid;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
use App\DoctrineExtensions\Timestampable\Traits\UserTimestampableEntity;
use App\DoctrineExtensions\SoftDeleteable\Traits\UserSoftDeleteableEntity;
use Bluue\SalesBundle\Repository\BankRepository;
/**
* @ORM\Entity(repositoryClass=BankRepository::class)
* @ORM\Table(name="sales_bundle__bank", indexes={
* @ORM\Index(name="name", columns={"name"}),
* @ORM\Index(name="account_number", columns={"account_number"}),
* @ORM\Index(name="is_active", columns={"is_active"}),
* @ORM\Index(name="deleted_at", columns={"deleted_at"}),
* @ORM\Index(name="created_at", columns={"created_at"}),
* @ORM\Index(name="updated_at", columns={"updated_at"})
* })
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
*/
class Bank
{
use UserTimestampableEntity;
use UserSoftDeleteableEntity;
use IsActiveEntity;
/**
* @ORM\Id
* @ORM\Column(type="uuid")
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
private ?Uuid $id = null;
/**
* @ORM\Column(type="string", length=255)
*/
private string $name;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
private ?string $accountNumber;
/**
* @ORM\OneToMany(targetEntity=PaymentMethod::class, mappedBy="bank")
* @ORM\JoinColumn(nullable=true)
*/
private Collection $paymentMethods;
public function __construct()
{
$this->paymentMethods = new ArrayCollection();
}
/**
* @return Uuid|null
*/
public function getId(): ?Uuid
{
return $this->id;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
* @return $this
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return string|null
*/
public function getAccountNumber(): ?string
{
return $this->accountNumber;
}
/**
* @param string|null $accountNumber
* @return $this
*/
public function setAccountNumber(?string $accountNumber): self
{
$this->accountNumber = $accountNumber;
return $this;
}
/**
* @return Collection
*/
public function getPaymentMethods(): Collection
{
return $this->paymentMethods;
}
/**
* @param PaymentMethod $paymentMethod
* @return $this
*/
public function addPaymentMethod(PaymentMethod $paymentMethod): self
{
if (!$this->paymentMethods->contains($paymentMethod)) {
$this->paymentMethods[] = $paymentMethod;
$paymentMethod->setBank($this);
}
return $this;
}
}