<?php
namespace App\Entity;
use App\Repository\BankRepository;
use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation\Ignore;
/**
* @ORM\Entity(repositoryClass=BankRepository::class)
* @UniqueEntity(fields={"label"}, message="Cette banque existe déjà.")
* @UniqueEntity(fields={"acronym"}, message="Ce sigle existe déjà.")
* @UniqueEntity(fields={"swiftCode"}, message="Ce code swift existe déjà.")
* @Auditable()
*/
class Bank
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $label;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $status;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isDeleted;
/**
* @ORM\OneToMany(targetEntity=BankAccount::class, mappedBy="bank")
*/
private $bankAccounts;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $acronym;
/**
* @Ignore()
* @ORM\ManyToOne(targetEntity=Users::class)
*/
private $userCreate;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateCreate;
/**
* @Ignore()
* @ORM\ManyToOne(targetEntity=Users::class)
*/
private $userUpdate;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateUpdate;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $swiftCode;
public function __construct()
{
$this->bankAccounts = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(?int $status): self
{
$this->status = $status;
return $this;
}
public function getIsDeleted(): ?bool
{
return $this->isDeleted;
}
public function setIsDeleted(?bool $isDeleted): self
{
$this->isDeleted = $isDeleted;
return $this;
}
/**
* @return Collection|BankAccount[]
*/
public function getBankAccounts(): Collection
{
return $this->bankAccounts;
}
public function addBankAccount(BankAccount $bankAccount): self
{
if (!$this->bankAccounts->contains($bankAccount)) {
$this->bankAccounts[] = $bankAccount;
$bankAccount->setBank($this);
}
return $this;
}
public function removeBankAccount(BankAccount $bankAccount): self
{
if ($this->bankAccounts->removeElement($bankAccount)) {
// set the owning side to null (unless already changed)
if ($bankAccount->getBank() === $this) {
$bankAccount->setBank(null);
}
}
return $this;
}
public function getAcronym(): ?string
{
return $this->acronym;
}
public function setAcronym(?string $acronym): self
{
$this->acronym = $acronym;
return $this;
}
/**
* @Ignore()
*/
public function getUserCreate(): ?Users
{
return $this->userCreate;
}
public function setUserCreate(?Users $userCreate): self
{
$this->userCreate = $userCreate;
return $this;
}
public function getDateCreate(): ?\DateTimeInterface
{
return $this->dateCreate;
}
public function setDateCreate(?\DateTimeInterface $dateCreate): self
{
$this->dateCreate = $dateCreate;
return $this;
}
/**
* @Ignore()
*/
public function getUserUpdate(): ?Users
{
return $this->userUpdate;
}
public function setUserUpdate(?Users $userUpdate): self
{
$this->userUpdate = $userUpdate;
return $this;
}
public function getDateUpdate(): ?\DateTimeInterface
{
return $this->dateUpdate;
}
public function setDateUpdate(?\DateTimeInterface $dateUpdate): self
{
$this->dateUpdate = $dateUpdate;
return $this;
}
public function getSwiftCode(): ?string
{
return $this->swiftCode;
}
public function setSwiftCode(?string $swiftCode): self
{
$this->swiftCode = $swiftCode;
return $this;
}
}