src/Entity/Domains/Domain.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Domains;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Generic\User;
  5. use App\Entity\Telegram\AgentPublicBot\Bot;
  6. use App\Repository\Domains\DomainRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  11. #[ORM\Entity(repositoryClassDomainRepository::class)]
  12. class Domain extends BaseEntity
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\Column(type'guid'uniquetrue)]
  16.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  17.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  18.     private ?string $id null;
  19.     #[ORM\Column(length255)]
  20.     private ?string $address null;
  21.     #[ORM\ManyToOne(inversedBy'domains')]
  22.     #[ORM\JoinColumn(nullablefalse)]
  23.     private ?User $owner null;
  24.     #[ORM\Column(length255nullabletrue)]
  25.     private ?string $tgContact null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $tgChannle null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $wallpaper null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $appName null;
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $ns1 null;
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $ns2 null;
  36.     #[ORM\OneToMany(mappedBy'domain'targetEntityBot::class)]
  37.     private Collection $bots;
  38.     #[ORM\Column(length255nullabletrue)]
  39.     private ?string $logo null;
  40.     #[ORM\Column]
  41.     private ?bool $isConnected null;
  42.     public function __construct()
  43.     {
  44.         parent::__construct();
  45.         $this->setIsConnected(0);
  46.         $this->bots = new ArrayCollection();
  47.     }
  48.     public function getNiceNs()
  49.     {
  50.         return 'NS1 : '.$this->getNs1().'<br>'.'NS2 : '.$this
  51.         ->getNs2();
  52.     }
  53.     public function __toString():string
  54.     {
  55.         return  $this->getAddress();
  56.     }
  57.     public function getId(): ?string
  58.     {
  59.         return $this->id;
  60.     }
  61.     public function getAddress(): ?string
  62.     {
  63.         return $this->address;
  64.     }
  65.     public function setAddress(string $address): static
  66.     {
  67.         $this->address $address;
  68.         return $this;
  69.     }
  70.     public function getOwner(): ?User
  71.     {
  72.         return $this->owner;
  73.     }
  74.     public function setOwner(?User $owner): static
  75.     {
  76.         $this->owner $owner;
  77.         return $this;
  78.     }
  79.     public function getTgContact(): ?string
  80.     {
  81.         return $this->tgContact;
  82.     }
  83.     public function setTgContact(?string $tgContact): static
  84.     {
  85.         $this->tgContact $tgContact;
  86.         return $this;
  87.     }
  88.     public function getTgChannle(): ?string
  89.     {
  90.         return $this->tgChannle;
  91.     }
  92.     public function setTgChannle(?string $tgChannle): static
  93.     {
  94.         $this->tgChannle $tgChannle;
  95.         return $this;
  96.     }
  97.     public function getWallpaper(): ?string
  98.     {
  99.         return $this->wallpaper;
  100.     }
  101.     public function setWallpaper(?string $wallpaper): static
  102.     {
  103.         $this->wallpaper $wallpaper;
  104.         return $this;
  105.     }
  106.     public function getAppName(): ?string
  107.     {
  108.         return $this->appName;
  109.     }
  110.     public function setAppName(?string $appName): static
  111.     {
  112.         $this->appName $appName;
  113.         return $this;
  114.     }
  115.     public function getNs1(): ?string
  116.     {
  117.         return $this->ns1;
  118.     }
  119.     public function setNs1(?string $ns1): static
  120.     {
  121.         $this->ns1 $ns1;
  122.         return $this;
  123.     }
  124.     public function getNs2(): ?string
  125.     {
  126.         return $this->ns2;
  127.     }
  128.     public function setNs2(?string $ns2): static
  129.     {
  130.         $this->ns2 $ns2;
  131.         return $this;
  132.     }
  133.     /**
  134.      * @return Collection<int, Bot>
  135.      */
  136.     public function getBots(): Collection
  137.     {
  138.         return $this->bots;
  139.     }
  140.     public function addBot(Bot $bot): static
  141.     {
  142.         if (!$this->bots->contains($bot)) {
  143.             $this->bots->add($bot);
  144.             $bot->setDomain($this);
  145.         }
  146.         return $this;
  147.     }
  148.     public function removeBot(Bot $bot): static
  149.     {
  150.         if ($this->bots->removeElement($bot)) {
  151.             // set the owning side to null (unless already changed)
  152.             if ($bot->getDomain() === $this) {
  153.                 $bot->setDomain(null);
  154.             }
  155.         }
  156.         return $this;
  157.     }
  158.     public function getLogo(): ?string
  159.     {
  160.         return $this->logo;
  161.     }
  162.     public function setLogo(?string $logo): static
  163.     {
  164.         $this->logo $logo;
  165.         return $this;
  166.     }
  167.     public function isIsConnected(): ?bool
  168.     {
  169.         return $this->isConnected;
  170.     }
  171.     public function setIsConnected(bool $isConnected): static
  172.     {
  173.         $this->isConnected $isConnected;
  174.         return $this;
  175.     }
  176. }