src/Entity/Bank.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BankRepository;
  4. use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Symfony\Component\Serializer\Annotation\Ignore;
  10. /**
  11.  * @ORM\Entity(repositoryClass=BankRepository::class)
  12.  * @UniqueEntity(fields={"label"}, message="Cette banque existe déjà.")
  13.  * @UniqueEntity(fields={"acronym"}, message="Ce sigle existe déjà.")
  14.  * @UniqueEntity(fields={"swiftCode"}, message="Ce code swift existe déjà.")
  15.  * @Auditable()
  16.  */
  17. class Bank
  18. {
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\Column(type="string", length=255)
  27.      */
  28.     private $label;
  29.     /**
  30.      * @ORM\Column(type="integer", nullable=true)
  31.      */
  32.     private $status;
  33.     /**
  34.      * @ORM\Column(type="boolean", nullable=true)
  35.      */
  36.     private $isDeleted;
  37.     /**
  38.      * @ORM\OneToMany(targetEntity=BankAccount::class, mappedBy="bank")
  39.      */
  40.     private $bankAccounts;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      */
  44.     private $acronym;
  45.     /**
  46.      * @Ignore()
  47.      * @ORM\ManyToOne(targetEntity=Users::class)
  48.      */
  49.     private $userCreate;
  50.     /**
  51.      * @ORM\Column(type="datetime", nullable=true)
  52.      */
  53.     private $dateCreate;
  54.     /**
  55.      *  @Ignore()
  56.      *  @ORM\ManyToOne(targetEntity=Users::class)
  57.      */
  58.     private $userUpdate;
  59.     /**
  60.      * @ORM\Column(type="datetime", nullable=true)
  61.      */
  62.     private $dateUpdate;
  63.     /**
  64.      * @ORM\Column(type="string", length=255, nullable=true)
  65.      */
  66.     private $swiftCode;
  67.     public function __construct()
  68.     {
  69.         $this->bankAccounts = new ArrayCollection();
  70.     }
  71.     public function getId(): ?int
  72.     {
  73.         return $this->id;
  74.     }
  75.     public function getLabel(): ?string
  76.     {
  77.         return $this->label;
  78.     }
  79.     public function setLabel(string $label): self
  80.     {
  81.         $this->label $label;
  82.         return $this;
  83.     }
  84.     public function getStatus(): ?int
  85.     {
  86.         return $this->status;
  87.     }
  88.     public function setStatus(?int $status): self
  89.     {
  90.         $this->status $status;
  91.         return $this;
  92.     }
  93.     public function getIsDeleted(): ?bool
  94.     {
  95.         return $this->isDeleted;
  96.     }
  97.     public function setIsDeleted(?bool $isDeleted): self
  98.     {
  99.         $this->isDeleted $isDeleted;
  100.         return $this;
  101.     }
  102.     /**
  103.      * @return Collection|BankAccount[]
  104.      */
  105.     public function getBankAccounts(): Collection
  106.     {
  107.         return $this->bankAccounts;
  108.     }
  109.     public function addBankAccount(BankAccount $bankAccount): self
  110.     {
  111.         if (!$this->bankAccounts->contains($bankAccount)) {
  112.             $this->bankAccounts[] = $bankAccount;
  113.             $bankAccount->setBank($this);
  114.         }
  115.         return $this;
  116.     }
  117.     public function removeBankAccount(BankAccount $bankAccount): self
  118.     {
  119.         if ($this->bankAccounts->removeElement($bankAccount)) {
  120.             // set the owning side to null (unless already changed)
  121.             if ($bankAccount->getBank() === $this) {
  122.                 $bankAccount->setBank(null);
  123.             }
  124.         }
  125.         return $this;
  126.     }
  127.     public function getAcronym(): ?string
  128.     {
  129.         return $this->acronym;
  130.     }
  131.     public function setAcronym(?string $acronym): self
  132.     {
  133.         $this->acronym $acronym;
  134.         return $this;
  135.     }
  136.      /**
  137.      * @Ignore()
  138.      */
  139.     public function getUserCreate(): ?Users
  140.     {
  141.         return $this->userCreate;
  142.     }
  143.     public function setUserCreate(?Users $userCreate): self
  144.     {
  145.         $this->userCreate $userCreate;
  146.         return $this;
  147.     }
  148.     public function getDateCreate(): ?\DateTimeInterface
  149.     {
  150.         return $this->dateCreate;
  151.     }
  152.     public function setDateCreate(?\DateTimeInterface $dateCreate): self
  153.     {
  154.         $this->dateCreate $dateCreate;
  155.         return $this;
  156.     }
  157.      /**
  158.      * @Ignore()
  159.      */
  160.     public function getUserUpdate(): ?Users
  161.     {
  162.         return $this->userUpdate;
  163.     }
  164.     public function setUserUpdate(?Users $userUpdate): self
  165.     {
  166.         $this->userUpdate $userUpdate;
  167.         return $this;
  168.     }
  169.     public function getDateUpdate(): ?\DateTimeInterface
  170.     {
  171.         return $this->dateUpdate;
  172.     }
  173.     public function setDateUpdate(?\DateTimeInterface $dateUpdate): self
  174.     {
  175.         $this->dateUpdate $dateUpdate;
  176.         return $this;
  177.     }
  178.     public function getSwiftCode(): ?string
  179.     {
  180.         return $this->swiftCode;
  181.     }
  182.     public function setSwiftCode(?string $swiftCode): self
  183.     {
  184.         $this->swiftCode $swiftCode;
  185.         return $this;
  186.     }
  187. }