src/Infrastructure/Doctrine/Entity/DoctrineIzOrderClientContact.php line 16

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Infrastructure\Doctrine\Entity;
  4. use App\Domain\Common\Entity\IzOrderClient;
  5. use App\Domain\Common\Entity\IzOrderClientContact;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Entity(repositoryClass="App\Infrastructure\Doctrine\Repository\DoctrineIzOrderClientContactRepository")
  11.  */
  12. class DoctrineIzOrderClientContact implements IzOrderClientContact
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\Column(type="string", length=16, unique=true)
  17.      */
  18.     private string $codeContact '';
  19.     /**
  20.      * @var Collection<int, IzOrderClient>
  21.      *
  22.      * @ORM\OneToMany(targetEntity="App\Infrastructure\Doctrine\Entity\DoctrineIzOrderClient", mappedBy="contact")
  23.      * @ORM\JoinColumn(name="code_client", referencedColumnName="code_client")
  24.      */
  25.     private iterable $clients;
  26.     /**
  27.      * @ORM\Column(type="string", length=191, nullable=true)
  28.      */
  29.     private ?string $nom null;
  30.     /**
  31.      * @ORM\Column(type="string", length=191, nullable=true)
  32.      */
  33.     private ?string $email null;
  34.     public function __construct()
  35.     {
  36.         $this->clients = new ArrayCollection();
  37.     }
  38.     public function getCodeContact(): string
  39.     {
  40.         return $this->codeContact;
  41.     }
  42.     public function setCodeContact(string $codeContact): void
  43.     {
  44.         $this->codeContact $codeContact;
  45.     }
  46.     /**
  47.      * {@inheritDoc}
  48.      */
  49.     public function getClients(): iterable
  50.     {
  51.         return $this->clients;
  52.     }
  53.     public function addClient(IzOrderClient $client): void
  54.     {
  55.         if (!$this->clients->contains($client)) {
  56.             $this->clients[] = $client;
  57.             $client->setContact($this);
  58.         }
  59.     }
  60.     public function removeClient(IzOrderClient $client): void
  61.     {
  62.         if ($this->clients->removeElement($client) && $client->getContact() === $this) {
  63.             $client->setContact(null);
  64.         }
  65.     }
  66.     public function getNom(): ?string
  67.     {
  68.         return $this->nom;
  69.     }
  70.     public function setNom(?string $nom): void
  71.     {
  72.         $this->nom $nom;
  73.     }
  74.     public function getEmail(): ?string
  75.     {
  76.         return $this->email;
  77.     }
  78.     public function setEmail(?string $email): void
  79.     {
  80.         $this->email $email;
  81.     }
  82. }