| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Core;
- use ApiPlatform\Metadata\ApiResource;
- use App\Entity\Organization\Organization;
- use App\Entity\Person\Person;
- use App\Repository\Core\BankAccountRepository;
- // 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 JetBrains\PhpStorm\Pure;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * Données bancaire d'une Person ou d'une Organization.
- *
- * Security :
- *
- * * @see App\Security\Voter\BankAccountVoter
- */
- #[ApiResource(operations: [])]
- // #[Auditable]
- #[ORM\Entity(repositoryClass: BankAccountRepository::class)]
- class BankAccount
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- private ?int $id = null;
- #[ORM\Column(length: 255, nullable: true)]
- private ?string $bankName = null;
- #[ORM\Column(length: 11, nullable: true)]
- #[Assert\Bic(message: 'invalid_bic')]
- private ?string $bic = null;
- #[ORM\Column(length: 255, nullable: true)]
- private ?string $bicInvalid = null;
- #[ORM\Column(length: 34, nullable: true)]
- #[Assert\Iban(message: 'invalid_iban')]
- private ?string $iban = null;
- #[ORM\Column(length: 255, nullable: true)]
- private ?string $ibanInvalid = null;
- #[ORM\Column(options: ['default' => false])]
- private bool $holderIdDifferent = false;
- /**
- * 0 => jamais facturé, 1 => facturé 1 fois, 2 => facturé plusieurs fois.
- */
- #[ORM\Column(columnDefinition: "TINYINT DEFAULT 0 NOT NULL")]
- private int $countInvoiced = 0;
- #[ORM\Column(length: 255, nullable: true)]
- private ?string $holder = null;
- #[ORM\Column(options: ['default' => false])]
- #[Assert\NotNull]
- private bool $principal = false;
- #[ORM\Column(type: 'text', nullable: true)]
- private ?string $debitAddress = null;
- #[ORM\Column(length: 35, unique: true, nullable: true)]
- private ?string $rum = null;
- #[ORM\Column(type: 'date', nullable: true)]
- private ?\DateTimeInterface $signatureDateSamplingMandate;
- /** @var Collection<int, Organization> */
- #[ORM\ManyToMany(targetEntity: Organization::class, mappedBy: 'bankAccounts', cascade: ['persist'])]
- private Collection $organization;
- /** @var Collection<int, Person> */
- #[ORM\ManyToMany(targetEntity: Person::class, mappedBy: 'bankAccount', cascade: ['persist'])]
- private Collection $person;
- #[Pure]
- public function __construct()
- {
- $this->organization = new ArrayCollection();
- $this->person = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getBankName(): ?string
- {
- return $this->bankName;
- }
- public function setBankName(?string $bankName): self
- {
- $this->bankName = $bankName;
- return $this;
- }
- public function getBic(): ?string
- {
- return $this->bic;
- }
- public function setBic(?string $bic): self
- {
- $this->bic = $bic;
- return $this;
- }
- public function getBicInvalid(): ?string
- {
- return $this->bicInvalid;
- }
- public function setBicInvalid(?string $bicInvalid): self
- {
- $this->bicInvalid = $bicInvalid;
- return $this;
- }
- public function getIban(): ?string
- {
- return $this->iban;
- }
- public function setIban(?string $iban): self
- {
- $this->iban = $iban;
- return $this;
- }
- public function getIbanInvalid(): ?string
- {
- return $this->ibanInvalid;
- }
- public function setIbanInvalid(?string $ibanInvalid): self
- {
- $this->ibanInvalid = $ibanInvalid;
- return $this;
- }
- public function getHolderIdDifferent(): bool
- {
- return $this->holderIdDifferent;
- }
- public function setHolderIdDifferent(bool $holderIdDifferent): self
- {
- $this->holderIdDifferent = $holderIdDifferent;
- return $this;
- }
- public function getCountInvoiced(): int
- {
- return $this->countInvoiced;
- }
- public function setCountInvoiced(int $countInvoiced): self
- {
- $this->countInvoiced = $countInvoiced;
- return $this;
- }
- public function getHolder(): ?string
- {
- return $this->holder;
- }
- public function setHolder(?string $holder): self
- {
- $this->holder = $holder;
- return $this;
- }
- public function getPrincipal(): bool
- {
- return $this->principal;
- }
- public function setPrincipal(bool $principal): self
- {
- $this->principal = $principal;
- return $this;
- }
- public function getDebitAddress(): ?string
- {
- return $this->debitAddress;
- }
- public function setDebitAddress(?string $debitAddress): self
- {
- $this->debitAddress = $debitAddress;
- return $this;
- }
- public function getOrganization(): Collection
- {
- return $this->organization;
- }
- public function addOrganization(Organization $organization): self
- {
- if (!$this->organization->contains($organization)) {
- $this->organization[] = $organization;
- $organization->addBankAccount($this);
- }
- return $this;
- }
- public function removeOrganization(Organization $organization): self
- {
- if ($this->organization->removeElement($organization)) {
- $organization->removeBankAccount($this);
- }
- return $this;
- }
- public function getRum(): ?string
- {
- return $this->rum;
- }
- public function setRum(?string $rum): self
- {
- $this->rum = $rum;
- return $this;
- }
- public function getSignatureDateSamplingMandate(): ?\DateTimeInterface
- {
- return $this->signatureDateSamplingMandate;
- }
- public function setSignatureDateSamplingMandate(?\DateTimeInterface $signatureDateSamplingMandate): self
- {
- $this->signatureDateSamplingMandate = $signatureDateSamplingMandate;
- return $this;
- }
- /**
- * @return Collection<int, Person>
- */
- public function getPerson(): Collection
- {
- return $this->person;
- }
- public function addPerson(Person $person): self
- {
- if (!$this->person->contains($person)) {
- $this->person[] = $person;
- $person->addBankAccount($this);
- }
- return $this;
- }
- public function removePerson(Person $person): self
- {
- if ($this->person->removeElement($person)) {
- $person->removeBankAccount($this);
- }
- return $this;
- }
- }
|