From 2e6c717d88431ccf40778c83e77c0056308c32fd Mon Sep 17 00:00:00 2001 From: "a.shamavov" Date: Thu, 2 May 2024 13:18:26 +0500 Subject: [PATCH] =?UTF-8?q?STA-965=20|=20=D0=9F=D0=BE=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=20uuid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Entity/File.php | 1 + src/Entity/Gallery.php | 5 +- src/Entity/Kitchen.php | 1 + src/Entity/News.php | 1 + src/Entity/NewsCategory.php | 1 + src/Entity/NewsComment.php | 1 + src/Entity/NewsType.php | 1 + src/Entity/Restaurant.php | 127 ++++++++-------------------------- src/Entity/RestaurantType.php | 1 + src/Entity/Seo.php | 1 + src/Entity/Settlement.php | 1 + src/Entity/Tags.php | 1 + src/Entity/User.php | 1 + 13 files changed, 42 insertions(+), 101 deletions(-) diff --git a/src/Entity/File.php b/src/Entity/File.php index 39432fc..712eb87 100644 --- a/src/Entity/File.php +++ b/src/Entity/File.php @@ -10,6 +10,7 @@ use Symfony\Component\Uid\Uuid; class File { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; diff --git a/src/Entity/Gallery.php b/src/Entity/Gallery.php index 1edce96..05dd42a 100644 --- a/src/Entity/Gallery.php +++ b/src/Entity/Gallery.php @@ -4,14 +4,15 @@ namespace App\Entity; use App\Repository\GalleryRepository; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Uid\Uuid; #[ORM\Entity(repositoryClass: GalleryRepository::class)] class Gallery { #[ORM\Id] #[ORM\GeneratedValue] - #[ORM\Column] - private ?int $id = null; + #[ORM\Column(type: 'uuid', unique: true)] + private ?Uuid $id = null; #[ORM\ManyToOne(inversedBy: 'galleries')] #[ORM\JoinColumn(nullable: false)] diff --git a/src/Entity/Kitchen.php b/src/Entity/Kitchen.php index 0315324..91a71a3 100644 --- a/src/Entity/Kitchen.php +++ b/src/Entity/Kitchen.php @@ -10,6 +10,7 @@ use Symfony\Component\Uid\Uuid; class Kitchen { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; diff --git a/src/Entity/News.php b/src/Entity/News.php index 2f61753..3a57eb3 100644 --- a/src/Entity/News.php +++ b/src/Entity/News.php @@ -13,6 +13,7 @@ use Symfony\Component\Uid\Uuid; class News { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; diff --git a/src/Entity/NewsCategory.php b/src/Entity/NewsCategory.php index 1322e29..7fbe56b 100644 --- a/src/Entity/NewsCategory.php +++ b/src/Entity/NewsCategory.php @@ -12,6 +12,7 @@ use Symfony\Component\Uid\Uuid; class NewsCategory { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; diff --git a/src/Entity/NewsComment.php b/src/Entity/NewsComment.php index 683c324..46c066d 100644 --- a/src/Entity/NewsComment.php +++ b/src/Entity/NewsComment.php @@ -11,6 +11,7 @@ use Symfony\Component\Uid\Uuid; class NewsComment { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; diff --git a/src/Entity/NewsType.php b/src/Entity/NewsType.php index 27b05d3..abd94e1 100644 --- a/src/Entity/NewsType.php +++ b/src/Entity/NewsType.php @@ -12,6 +12,7 @@ use Symfony\Component\Uid\Uuid; class NewsType { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; diff --git a/src/Entity/Restaurant.php b/src/Entity/Restaurant.php index 304e779..f3fa475 100644 --- a/src/Entity/Restaurant.php +++ b/src/Entity/Restaurant.php @@ -13,6 +13,7 @@ use Symfony\Component\Uid\Uuid; class Restaurant { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; @@ -60,14 +61,14 @@ class Restaurant #[ORM\OneToMany(targetEntity: Kitchen::class, mappedBy: 'restaurant')] private Collection $kitchen; - #[ORM\Column(type: Types::JSON)] - private Collection $phone; + #[ORM\Column] + private array $phone = []; - #[ORM\Column(type: Types::JSON)] - private Collection $email; + #[ORM\Column] + private array $email = []; - #[ORM\Column(type: Types::JSON)] - private Collection $address; + #[ORM\Column] + private array $address = []; /** * @var Collection @@ -100,9 +101,6 @@ class Restaurant public function __construct() { $this->kitchen = new ArrayCollection(); - $this->phone = new ArrayCollection(); - $this->email = new ArrayCollection(); - $this->address = new ArrayCollection(); $this->tags = new ArrayCollection(); $this->galleries = new ArrayCollection(); } @@ -286,96 +284,6 @@ class Restaurant return $this; } - /** - * @return Collection - */ - public function getPhone(): Collection - { - return $this->phone; - } - - public function addPhone(Phone $phone): static - { - if (!$this->phone->contains($phone)) { - $this->phone->add($phone); - $phone->setRestaurant($this); - } - - return $this; - } - - public function removePhone(Phone $phone): static - { - if ($this->phone->removeElement($phone)) { - // set the owning side to null (unless already changed) - if ($phone->getRestaurant() === $this) { - $phone->setRestaurant(null); - } - } - - return $this; - } - - /** - * @return Collection - */ - public function getEmail(): Collection - { - return $this->email; - } - - public function addEmail(Email $email): static - { - if (!$this->email->contains($email)) { - $this->email->add($email); - $email->setRestaurant($this); - } - - return $this; - } - - public function removeEmail(Email $email): static - { - if ($this->email->removeElement($email)) { - // set the owning side to null (unless already changed) - if ($email->getRestaurant() === $this) { - $email->setRestaurant(null); - } - } - - return $this; - } - - /** - * @return Collection - */ - public function getAddress(): Collection - { - return $this->address; - } - - public function addAddress(Address $address): static - { - if (!$this->address->contains($address)) { - $this->address->add($address); - $address->setRestaurant($this); - } - - return $this; - } - - public function removeAddress(Address $address): static - { - if ($this->address->removeElement($address)) { - // set the owning side to null (unless already changed) - if ($address->getRestaurant() === $this) { - $address->setRestaurant(null); - } - } - - return $this; - } - /** * @return Collection */ @@ -495,4 +403,25 @@ class Restaurant return $this; } + + public function setPhone(array $phone): static + { + $this->phone = $phone; + + return $this; + } + + public function setEmail(array $email): static + { + $this->email = $email; + + return $this; + } + + public function setAddress(array $address): static + { + $this->address = $address; + + return $this; + } } diff --git a/src/Entity/RestaurantType.php b/src/Entity/RestaurantType.php index eb59ef7..447b0ee 100644 --- a/src/Entity/RestaurantType.php +++ b/src/Entity/RestaurantType.php @@ -12,6 +12,7 @@ use Symfony\Component\Uid\Uuid; class RestaurantType { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; diff --git a/src/Entity/Seo.php b/src/Entity/Seo.php index e68bb30..59d2140 100644 --- a/src/Entity/Seo.php +++ b/src/Entity/Seo.php @@ -10,6 +10,7 @@ use Symfony\Component\Uid\Uuid; class Seo { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; diff --git a/src/Entity/Settlement.php b/src/Entity/Settlement.php index 94d8e4d..b6cb733 100644 --- a/src/Entity/Settlement.php +++ b/src/Entity/Settlement.php @@ -13,6 +13,7 @@ use Symfony\Component\Uid\Uuid; class Settlement { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; diff --git a/src/Entity/Tags.php b/src/Entity/Tags.php index a52ff23..03c7186 100644 --- a/src/Entity/Tags.php +++ b/src/Entity/Tags.php @@ -11,6 +11,7 @@ use Symfony\Component\Uid\Uuid; class Tags { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; diff --git a/src/Entity/User.php b/src/Entity/User.php index 208382f..1939b59 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -13,6 +13,7 @@ use Symfony\Component\Uid\Uuid; class User { #[ORM\Id] + #[ORM\GeneratedValue] #[ORM\Column(type: 'uuid', unique: true)] private ?Uuid $id = null; -- GitLab