diff --git a/src/DataFixtures/RestaurantDataFixtures.php b/src/DataFixtures/RestaurantDataFixtures.php index 85340312a92918d7441c61e747b619962cf04491..cdfd692ff996a9424cc33282ec930c825535ad99 100644 --- a/src/DataFixtures/RestaurantDataFixtures.php +++ b/src/DataFixtures/RestaurantDataFixtures.php @@ -2,18 +2,17 @@ namespace App\DataFixtures; +use App\Entity\File; +use App\Entity\Gallery; use App\Entity\Restaurant; +use App\Entity\Seo; use App\Entity\Tags; use DateTime; -use App\Entity\Address; -use App\Entity\Email; use App\Entity\Kitchen; -use App\Entity\Phone; use App\Entity\RestaurantType; use App\Entity\Settlement; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; -use Symfony\Component\Uid\Uuid; class RestaurantDataFixtures extends Fixture { @@ -23,14 +22,24 @@ class RestaurantDataFixtures extends Fixture ->setName("Ресторан") ->setCode("restoran"); $settlement = (new Settlement()) - ->setUuid(Uuid::v4()) ->setName("г. Тюмень") ->setCode("tyumen") ->setCoordinates([142, 214]) ->setCreateAt(new DateTime("02-12-2023")) ->setUpdateAt(new DateTime("05-12-2023")); + $seo = (new Seo()) + ->setTitle("Отель Арктика") + ->setDescription("otel-arktika") + ->setKeywords("otel-arktika"); + $file = (new File()) + ->setName("asd") + ->setDescription("Краткое описание") + ->setType("png") + ->setUrl("/upload/asd.png") + ->setSize(1024); + $gallery = (new Gallery()) + ->setFile($file) $restaurant = (new Restaurant()) - ->setUuid(Uuid::v4()) ->setName("Ресторан «Арктика»") ->setCode("restoran-arktika") ->setCoordinates([123, 321]) @@ -46,28 +55,23 @@ class RestaurantDataFixtures extends Fixture ->setTypeId($restaurantType) ->setSettlementId($settlement) ->setSite("https://visityamal.ru/") - ->setSort(1); - $phone = (new Phone()) - ->setName("7999999999") - ->setRestaurant($restaurant); - $email = (new Email()) - ->setName("test@mail.ru") - ->setRestaurant($restaurant); - $address = (new Address()) - ->setName("ул.Пушкина дом Колотушкина") - ->setRestaurant($restaurant); + ->setSort(1) + ->setPhone(["7999999999"]) + ->setEmail(["test@mail.ru"]) + ->setAddress(["ул.Пушкина дом Колотушкина"]) + ->setSeo($seo) + ->addGallery(); $kitchen = (new Kitchen()) ->setName("Азиатская") ->setRestaurant($restaurant); $tags = (new Tags()) - ->setName("тег1") + ->setName("группа тегов 1") + ->setList(["тег1", "тег2"]) ->setRestaurant($restaurant); $manager->persist($restaurantType); + $manager->persist($seo); $manager->persist($settlement); $manager->persist($restaurant); - $manager->persist($phone); - $manager->persist($email); - $manager->persist($address); $manager->persist($kitchen); $manager->persist($tags); $manager->flush(); diff --git a/src/Entity/File.php b/src/Entity/File.php index 712eb87b58029a09d98d125e05eca3873c9561e2..f75b55d50702a356f3736b9db379cb2e5c8a4cb2 100644 --- a/src/Entity/File.php +++ b/src/Entity/File.php @@ -34,12 +34,12 @@ class File return $this->id; } - public function setId(Uuid $id): static - { - $this->id = $id; - - return $this; - } +// public function setId(Uuid $id): static +// { +// $this->id = $id; +// +// return $this; +// } public function getName(): ?string {