src/Entity/Messengers.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Validator\Constraints\TelegramUsernameNotValid;
  5. #[ORM\Embeddable]
  6. final class Messengers
  7. {
  8.     #[ORM\Column(name'messengers_telegram'type'boolean'nullabletrue)]
  9.     protected ?bool $telegram;
  10.     #[ORM\Column(name'messengers_whatsapp'type'integer'nullabletrue)]
  11.     protected ?bool $whatsApp;
  12.     #[ORM\Column(name'messengers_telegram_username'type'string'length32nullabletrue)]
  13.     #[TelegramUsernameNotValid]
  14.     protected ?string $telegramUsername null;
  15.     public function __construct(?bool $telegram, ?bool $whatsApp, ?string $telegramUsername)
  16.     {
  17.         $this->telegram $telegram;
  18.         $this->whatsApp $whatsApp;
  19.         $this->telegramUsername $telegramUsername;
  20.     }
  21.     public function hasTelegram(): ?bool
  22.     {
  23.         return $this->telegram;
  24.     }
  25.     public function hasWhatsApp(): ?bool
  26.     {
  27.         return $this->whatsApp;
  28.     }
  29.     public function getTelegramUsername(): ?string
  30.     {
  31.         return $this->telegramUsername;
  32.     }
  33. }