src/Entity/BranchOffice.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BranchOfficeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Symfony\Component\String\Slugger\SluggerInterface;
  10. #[ORM\Entity(repositoryClassBranchOfficeRepository::class)]
  11. #[UniqueEntity('slug')]
  12. class BranchOffice
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $name null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $title null;
  22.     #[ORM\Column(length255nullabletrue)]
  23.     private ?string $address null;
  24.     #[ORM\Column(length255nullabletrue)]
  25.     private ?string $phoneNumber null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $color null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $vkLink null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $whatsappLink null;
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $instLink null;
  34.     #[ORM\Column(type'string'length255uniquetrue)]
  35.     private ?string $slug null;
  36.     #[ORM\Column(length255)]
  37.     private ?string $backgroundImageUrl null;
  38.     #[ORM\OneToMany(mappedBy'branchOffice'targetEntityAlbum::class, cascade: ['remove'])]
  39.     private Collection $albums;
  40.     #[ORM\OneToMany(mappedBy'branchOffice'targetEntityMenuCard::class, orphanRemovaltruecascade: ['persist'])]
  41.     private Collection $menuCards;
  42.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  43.     private ?string $widgetFlamp null;
  44.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  45.     private ?string $widget2gis null;
  46.     public function __construct()
  47.     {
  48.         $this->albums = new ArrayCollection();
  49.         $this->menuCards = new ArrayCollection();
  50.     }
  51.     public function __toString(): string
  52.     {
  53.         return $this->name;
  54.     }
  55.     public function computeSlug(SluggerInterface $slugger)
  56.     {
  57.         if (!$this->slug || '-' == $this->slug) {
  58.             $this->slug = (string) $slugger->slug((string) $this->getName())->lower();
  59.         }
  60.     }
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getName(): ?string
  66.     {
  67.         return $this->name;
  68.     }
  69.     public function setName(string $name): self
  70.     {
  71.         $this->name $name;
  72.         return $this;
  73.     }
  74.     public function getTitle(): ?string
  75.     {
  76.         return $this->title;
  77.     }
  78.     public function setTitle(?string $title): self
  79.     {
  80.         $this->title $title;
  81.         return $this;
  82.     }
  83.     public function getAddress(): ?string
  84.     {
  85.         return $this->address;
  86.     }
  87.     public function setAddress(?string $address): self
  88.     {
  89.         $this->address $address;
  90.         return $this;
  91.     }
  92.     public function getPhoneNumber(): ?string
  93.     {
  94.         return $this->phoneNumber;
  95.     }
  96.     public function setPhoneNumber(?string $phoneNumber): self
  97.     {
  98.         $this->phoneNumber $phoneNumber;
  99.         return $this;
  100.     }
  101.     public function getColor(): ?string
  102.     {
  103.         return $this->color;
  104.     }
  105.     public function setColor(?string $color): self
  106.     {
  107.         $this->color $color;
  108.         return $this;
  109.     }
  110.     public function getVkLink(): ?string
  111.     {
  112.         return $this->vkLink;
  113.     }
  114.     public function setVkLink(?string $vkLink): self
  115.     {
  116.         $this->vkLink $vkLink;
  117.         return $this;
  118.     }
  119.     public function getWhatsappLink(): ?string
  120.     {
  121.         return $this->whatsappLink;
  122.     }
  123.     public function setWhatsappLink(?string $whatsappLink): self
  124.     {
  125.         $this->whatsappLink $whatsappLink;
  126.         return $this;
  127.     }
  128.     public function getInstLink(): ?string
  129.     {
  130.         return $this->instLink;
  131.     }
  132.     public function setInstLink(?string $instLink): self
  133.     {
  134.         $this->instLink $instLink;
  135.         return $this;
  136.     }
  137.     public function getSlug(): ?string
  138.     {
  139.         return $this->slug;
  140.     }
  141.     public function setSlug(string $slug): self
  142.     {
  143.         $this->slug $slug;
  144.         return $this;
  145.     }
  146.     public function getBackgroundImageUrl(): ?string
  147.     {
  148.         return $this->backgroundImageUrl;
  149.     }
  150.     public function setBackgroundImageUrl(string $backgroundImageUrl): self
  151.     {
  152.         $this->backgroundImageUrl $backgroundImageUrl;
  153.         return $this;
  154.     }
  155.     /**
  156.      * @return Collection<int, Album>
  157.      */
  158.     public function getAlbums(): Collection
  159.     {
  160.         return $this->albums;
  161.     }
  162.     public function addAlbum(Album $album): self
  163.     {
  164.         if (!$this->albums->contains($album)) {
  165.             $this->albums->add($album);
  166.             $album->setBranchOffice($this);
  167.         }
  168.         return $this;
  169.     }
  170.     public function removeAlbum(Album $album): self
  171.     {
  172.         if ($this->albums->removeElement($album)) {
  173.             if ($album->getBranchOffice() === $this) {
  174.                 $album->setBranchOffice(null);
  175.             }
  176.         }
  177.         return $this;
  178.     }
  179.     /**
  180.      * @return Collection<int, MenuCard>
  181.      */
  182.     public function getMenuCards(): Collection
  183.     {
  184.         return $this->menuCards;
  185.     }
  186.     public function addMenuCard(MenuCard $menuCard): self
  187.     {
  188.         if (!$this->menuCards->contains($menuCard)) {
  189.             $this->menuCards->add($menuCard);
  190.             $menuCard->setBranchOffice($this);
  191.         }
  192.         return $this;
  193.     }
  194.     public function removeMenuCard(MenuCard $menuCard): self
  195.     {
  196.         if ($this->menuCards->removeElement($menuCard)) {
  197.             if ($menuCard->getBranchOffice() === $this) {
  198.                 $menuCard->setBranchOffice(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203.     public function getWidgetFlamp(): ?string
  204.     {
  205.         return $this->widgetFlamp;
  206.     }
  207.     public function setWidgetFlamp(?string $widgetFlamp): self
  208.     {
  209.         $this->widgetFlamp $widgetFlamp;
  210.         return $this;
  211.     }
  212.     public function getWidget2gis(): ?string
  213.     {
  214.         return $this->widget2gis;
  215.     }
  216.     public function setWidget2gis(?string $widget2gis): self
  217.     {
  218.         $this->widget2gis $widget2gis;
  219.         return $this;
  220.     }
  221. }