From 2812dbc79109def127fc2019fe9bcebfe819050d Mon Sep 17 00:00:00 2001 From: "Alex. Plokhikh" <a.plohih@iqdev.digital> Date: Mon, 22 Apr 2024 10:33:23 +0500 Subject: [PATCH] STA-959|add entities, add migration --- .gitignore | 3 +- app/config/packages/doctrine.yaml | 2 + app/migrations/Version20240419135600.php | 148 ++++++ app/src/Entity/Address.php | 51 ++ app/src/Entity/Email.php | 51 ++ app/src/Entity/Kitchens.php | 75 +++ app/src/Entity/News.php | 230 +++++++++ app/src/Entity/NewsCategories.php | 50 ++ app/src/Entity/NewsComments.php | 142 ++++++ app/src/Entity/NewsType.php | 93 ++++ app/src/Entity/Phone.php | 51 ++ app/src/Entity/RestauranTypes.php | 93 ++++ app/src/Entity/Restaurants.php | 461 ++++++++++++++++++ app/src/Entity/Settlements.php | 154 ++++++ app/src/Entity/Tags.php | 72 +++ app/src/Entity/Users.php | 221 +++++++++ app/src/Repository/AddressRepository.php | 48 ++ app/src/Repository/EmailRepository.php | 48 ++ app/src/Repository/KitchensRepository.php | 48 ++ .../Repository/NewsCategoriesRepository.php | 48 ++ app/src/Repository/NewsCommentsRepository.php | 48 ++ app/src/Repository/NewsRepository.php | 48 ++ app/src/Repository/NewsTypeRepository.php | 48 ++ app/src/Repository/PhoneRepository.php | 48 ++ .../Repository/RestauranTypesRepository.php | 48 ++ app/src/Repository/RestaurantsRepository.php | 48 ++ app/src/Repository/SettlementsRepository.php | 48 ++ app/src/Repository/TagsRepository.php | 48 ++ app/src/Repository/UsersRepository.php | 48 ++ app/templates/news_types/index.html.twig | 20 + docker/docker-compose.yml | 19 +- 31 files changed, 2550 insertions(+), 10 deletions(-) create mode 100644 app/migrations/Version20240419135600.php create mode 100644 app/src/Entity/Address.php create mode 100644 app/src/Entity/Email.php create mode 100644 app/src/Entity/Kitchens.php create mode 100644 app/src/Entity/News.php create mode 100644 app/src/Entity/NewsCategories.php create mode 100644 app/src/Entity/NewsComments.php create mode 100644 app/src/Entity/NewsType.php create mode 100644 app/src/Entity/Phone.php create mode 100644 app/src/Entity/RestauranTypes.php create mode 100644 app/src/Entity/Restaurants.php create mode 100644 app/src/Entity/Settlements.php create mode 100644 app/src/Entity/Tags.php create mode 100644 app/src/Entity/Users.php create mode 100644 app/src/Repository/AddressRepository.php create mode 100644 app/src/Repository/EmailRepository.php create mode 100644 app/src/Repository/KitchensRepository.php create mode 100644 app/src/Repository/NewsCategoriesRepository.php create mode 100644 app/src/Repository/NewsCommentsRepository.php create mode 100644 app/src/Repository/NewsRepository.php create mode 100644 app/src/Repository/NewsTypeRepository.php create mode 100644 app/src/Repository/PhoneRepository.php create mode 100644 app/src/Repository/RestauranTypesRepository.php create mode 100644 app/src/Repository/RestaurantsRepository.php create mode 100644 app/src/Repository/SettlementsRepository.php create mode 100644 app/src/Repository/TagsRepository.php create mode 100644 app/src/Repository/UsersRepository.php create mode 100644 app/templates/news_types/index.html.twig diff --git a/.gitignore b/.gitignore index 723ef36..3bf780b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea \ No newline at end of file +.idea +.env \ No newline at end of file diff --git a/app/config/packages/doctrine.yaml b/app/config/packages/doctrine.yaml index 75ec9e8..c94f706 100644 --- a/app/config/packages/doctrine.yaml +++ b/app/config/packages/doctrine.yaml @@ -1,6 +1,8 @@ doctrine: dbal: url: '%env(resolve:DATABASE_URL)%' + password: '%env(resolve:DATABASE_PASSWORD)%' + user: '%env(resolve:DATABASE_USER)%' # IMPORTANT: You MUST configure your server version, # either here or in the DATABASE_URL env var (see .env file) diff --git a/app/migrations/Version20240419135600.php b/app/migrations/Version20240419135600.php new file mode 100644 index 0000000..2502217 --- /dev/null +++ b/app/migrations/Version20240419135600.php @@ -0,0 +1,148 @@ +<?php + +declare(strict_types=1); + +namespace DoctrineMigrations; + +use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; + +/** + * Auto-generated Migration: Please modify to your needs! + */ +final class Version20240419135600 extends AbstractMigration +{ + public function getDescription(): string + { + return ''; + } + + public function up(Schema $schema): void + { + // this up() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SEQUENCE address_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE email_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE kitchens_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE news_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE news_categories_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE news_comments_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE news_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE phone_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE restauran_types_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE restaurants_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE settlements_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE tags_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE users_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE address (id INT NOT NULL, restaurant_id_id INT NOT NULL, address VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_D4E6F8135592D86 ON address (restaurant_id_id)'); + $this->addSql('CREATE TABLE email (id INT NOT NULL, restaurant_id_id INT NOT NULL, email VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_E7927C7435592D86 ON email (restaurant_id_id)'); + $this->addSql('CREATE TABLE kitchens (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE news (id INT NOT NULL, type_id_id INT NOT NULL, code VARCHAR(255) NOT NULL, active BOOLEAN NOT NULL, create_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, update_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, sort INT NOT NULL, preview_image VARCHAR(255) DEFAULT NULL, detail_image VARCHAR(1000) DEFAULT NULL, preview_text VARCHAR(1000) DEFAULT NULL, detail_test VARCHAR(1000) DEFAULT NULL, main_page_render BOOLEAN NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_1DD39950714819A0 ON news (type_id_id)'); + $this->addSql('COMMENT ON COLUMN news.create_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('CREATE TABLE news_categories (id INT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE news_comments (id INT NOT NULL, news_id_id INT NOT NULL, moderator_id_id INT DEFAULT NULL, user_id_id INT DEFAULT NULL, moderated BOOLEAN DEFAULT NULL, user_name VARCHAR(255) NOT NULL, test VARCHAR(1000) NOT NULL, create_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, update_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_16A0357B5FB1909 ON news_comments (news_id_id)'); + $this->addSql('CREATE INDEX IDX_16A0357BCEB712DF ON news_comments (moderator_id_id)'); + $this->addSql('CREATE INDEX IDX_16A0357B9D86650F ON news_comments (user_id_id)'); + $this->addSql('COMMENT ON COLUMN news_comments.create_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('CREATE TABLE news_type (id INT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE phone (id INT NOT NULL, restaurant_id_id INT NOT NULL, phone_number VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_444F97DD35592D86 ON phone (restaurant_id_id)'); + $this->addSql('CREATE TABLE restauran_types (id INT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE restaurants (id INT NOT NULL, type_id_id INT NOT NULL, settlement_id_id INT NOT NULL, uuid UUID NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, active BOOLEAN NOT NULL, sort INT NOT NULL, create_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, update_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, coordinates TEXT NOT NULL, description VARCHAR(1000) DEFAULT NULL, recipe VARCHAR(255) DEFAULT NULL, recipe_info VARCHAR(1000) DEFAULT NULL, site VARCHAR(255) DEFAULT NULL, preview_image VARCHAR(255) DEFAULT NULL, detail_image VARCHAR(255) DEFAULT NULL, how_to_find VARCHAR(1000) DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_AD837724714819A0 ON restaurants (type_id_id)'); + $this->addSql('CREATE INDEX IDX_AD83772445EC589B ON restaurants (settlement_id_id)'); + $this->addSql('COMMENT ON COLUMN restaurants.create_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN restaurants.coordinates IS \'(DC2Type:array)\''); + $this->addSql('CREATE TABLE restaurants_kitchens (restaurants_id INT NOT NULL, kitchens_id INT NOT NULL, PRIMARY KEY(restaurants_id, kitchens_id))'); + $this->addSql('CREATE INDEX IDX_716464694DCA160A ON restaurants_kitchens (restaurants_id)'); + $this->addSql('CREATE INDEX IDX_71646469E043FCBC ON restaurants_kitchens (kitchens_id)'); + $this->addSql('CREATE TABLE settlements (id INT NOT NULL, uuid UUID NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, coordinates TEXT NOT NULL, create_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, update_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))'); + $this->addSql('COMMENT ON COLUMN settlements.coordinates IS \'(DC2Type:array)\''); + $this->addSql('COMMENT ON COLUMN settlements.create_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('CREATE TABLE tags (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE tags_restaurants (tags_id INT NOT NULL, restaurants_id INT NOT NULL, PRIMARY KEY(tags_id, restaurants_id))'); + $this->addSql('CREATE INDEX IDX_7AEC1CD68D7B4FB4 ON tags_restaurants (tags_id)'); + $this->addSql('CREATE INDEX IDX_7AEC1CD64DCA160A ON tags_restaurants (restaurants_id)'); + $this->addSql('CREATE TABLE users (id INT NOT NULL, uuid UUID NOT NULL, name VARCHAR(255) NOT NULL, is_male BOOLEAN NOT NULL, birth_day TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, �ф�address VARCHAR(255) NOT NULL, surname VARCHAR(255) NOT NULL, phone_number VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('COMMENT ON COLUMN users.birth_day IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)'); + $this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)'); + $this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)'); + $this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$ + BEGIN + PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text); + RETURN NEW; + END; + $$ LANGUAGE plpgsql;'); + $this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;'); + $this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();'); + $this->addSql('ALTER TABLE address ADD CONSTRAINT FK_D4E6F8135592D86 FOREIGN KEY (restaurant_id_id) REFERENCES restaurants (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE email ADD CONSTRAINT FK_E7927C7435592D86 FOREIGN KEY (restaurant_id_id) REFERENCES restaurants (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950714819A0 FOREIGN KEY (type_id_id) REFERENCES news_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE news_comments ADD CONSTRAINT FK_16A0357B5FB1909 FOREIGN KEY (news_id_id) REFERENCES news (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE news_comments ADD CONSTRAINT FK_16A0357BCEB712DF FOREIGN KEY (moderator_id_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE news_comments ADD CONSTRAINT FK_16A0357B9D86650F FOREIGN KEY (user_id_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE phone ADD CONSTRAINT FK_444F97DD35592D86 FOREIGN KEY (restaurant_id_id) REFERENCES restaurants (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE restaurants ADD CONSTRAINT FK_AD837724714819A0 FOREIGN KEY (type_id_id) REFERENCES restauran_types (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE restaurants ADD CONSTRAINT FK_AD83772445EC589B FOREIGN KEY (settlement_id_id) REFERENCES settlements (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE restaurants_kitchens ADD CONSTRAINT FK_716464694DCA160A FOREIGN KEY (restaurants_id) REFERENCES restaurants (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE restaurants_kitchens ADD CONSTRAINT FK_71646469E043FCBC FOREIGN KEY (kitchens_id) REFERENCES kitchens (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE tags_restaurants ADD CONSTRAINT FK_7AEC1CD68D7B4FB4 FOREIGN KEY (tags_id) REFERENCES tags (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE tags_restaurants ADD CONSTRAINT FK_7AEC1CD64DCA160A FOREIGN KEY (restaurants_id) REFERENCES restaurants (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('DROP SEQUENCE address_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE email_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE kitchens_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE news_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE news_categories_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE news_comments_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE news_type_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE phone_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE restauran_types_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE restaurants_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE settlements_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE tags_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE users_id_seq CASCADE'); + $this->addSql('ALTER TABLE address DROP CONSTRAINT FK_D4E6F8135592D86'); + $this->addSql('ALTER TABLE email DROP CONSTRAINT FK_E7927C7435592D86'); + $this->addSql('ALTER TABLE news DROP CONSTRAINT FK_1DD39950714819A0'); + $this->addSql('ALTER TABLE news_comments DROP CONSTRAINT FK_16A0357B5FB1909'); + $this->addSql('ALTER TABLE news_comments DROP CONSTRAINT FK_16A0357BCEB712DF'); + $this->addSql('ALTER TABLE news_comments DROP CONSTRAINT FK_16A0357B9D86650F'); + $this->addSql('ALTER TABLE phone DROP CONSTRAINT FK_444F97DD35592D86'); + $this->addSql('ALTER TABLE restaurants DROP CONSTRAINT FK_AD837724714819A0'); + $this->addSql('ALTER TABLE restaurants DROP CONSTRAINT FK_AD83772445EC589B'); + $this->addSql('ALTER TABLE restaurants_kitchens DROP CONSTRAINT FK_716464694DCA160A'); + $this->addSql('ALTER TABLE restaurants_kitchens DROP CONSTRAINT FK_71646469E043FCBC'); + $this->addSql('ALTER TABLE tags_restaurants DROP CONSTRAINT FK_7AEC1CD68D7B4FB4'); + $this->addSql('ALTER TABLE tags_restaurants DROP CONSTRAINT FK_7AEC1CD64DCA160A'); + $this->addSql('DROP TABLE address'); + $this->addSql('DROP TABLE email'); + $this->addSql('DROP TABLE kitchens'); + $this->addSql('DROP TABLE news'); + $this->addSql('DROP TABLE news_categories'); + $this->addSql('DROP TABLE news_comments'); + $this->addSql('DROP TABLE news_type'); + $this->addSql('DROP TABLE phone'); + $this->addSql('DROP TABLE restauran_types'); + $this->addSql('DROP TABLE restaurants'); + $this->addSql('DROP TABLE restaurants_kitchens'); + $this->addSql('DROP TABLE settlements'); + $this->addSql('DROP TABLE tags'); + $this->addSql('DROP TABLE tags_restaurants'); + $this->addSql('DROP TABLE users'); + $this->addSql('DROP TABLE messenger_messages'); + } +} diff --git a/app/src/Entity/Address.php b/app/src/Entity/Address.php new file mode 100644 index 0000000..f42f489 --- /dev/null +++ b/app/src/Entity/Address.php @@ -0,0 +1,51 @@ +<?php + +namespace App\Entity; + +use App\Repository\AddressRepository; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: AddressRepository::class)] +class Address +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\ManyToOne(inversedBy: 'addresses_id')] + #[ORM\JoinColumn(nullable: false)] + private ?Restaurants $restaurant_id = null; + + #[ORM\Column(length: 255)] + private ?string $address = null; + + public function getId(): ?int + { + return $this->id; + } + + public function getRestaurantId(): ?Restaurants + { + return $this->restaurant_id; + } + + public function setRestaurantId(?Restaurants $restaurant_id): static + { + $this->restaurant_id = $restaurant_id; + + return $this; + } + + public function getAddress(): ?string + { + return $this->address; + } + + public function setAddress(string $address): static + { + $this->address = $address; + + return $this; + } +} diff --git a/app/src/Entity/Email.php b/app/src/Entity/Email.php new file mode 100644 index 0000000..8d4b850 --- /dev/null +++ b/app/src/Entity/Email.php @@ -0,0 +1,51 @@ +<?php + +namespace App\Entity; + +use App\Repository\EmailRepository; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: EmailRepository::class)] +class Email +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\ManyToOne(inversedBy: 'emails_id')] + #[ORM\JoinColumn(nullable: false)] + private ?Restaurants $restaurant_id = null; + + #[ORM\Column(length: 255)] + private ?string $email = null; + + public function getId(): ?int + { + return $this->id; + } + + public function getRestaurantId(): ?Restaurants + { + return $this->restaurant_id; + } + + public function setRestaurantId(?Restaurants $restaurant_id): static + { + $this->restaurant_id = $restaurant_id; + + return $this; + } + + public function getEmail(): ?string + { + return $this->email; + } + + public function setEmail(string $email): static + { + $this->email = $email; + + return $this; + } +} diff --git a/app/src/Entity/Kitchens.php b/app/src/Entity/Kitchens.php new file mode 100644 index 0000000..8aa783d --- /dev/null +++ b/app/src/Entity/Kitchens.php @@ -0,0 +1,75 @@ +<?php + +namespace App\Entity; + +use App\Repository\KitchensRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: KitchensRepository::class)] +class Kitchens +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(length: 255)] + private ?string $name = null; + + /** + * @var Collection<int, Restaurants> + */ + #[ORM\ManyToMany(targetEntity: Restaurants::class, mappedBy: 'kitchens_id')] + private Collection $restaurants_id; + + public function __construct() + { + $this->restaurants_id = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + /** + * @return Collection<int, Restaurants> + */ + public function getRestaurantsId(): Collection + { + return $this->restaurants_id; + } + + public function addRestaurantsId(Restaurants $restaurantsId): static + { + if (!$this->restaurants_id->contains($restaurantsId)) { + $this->restaurants_id->add($restaurantsId); + $restaurantsId->addKitchensId($this); + } + + return $this; + } + + public function removeRestaurantsId(Restaurants $restaurantsId): static + { + if ($this->restaurants_id->removeElement($restaurantsId)) { + $restaurantsId->removeKitchensId($this); + } + + return $this; + } +} diff --git a/app/src/Entity/News.php b/app/src/Entity/News.php new file mode 100644 index 0000000..bbc53be --- /dev/null +++ b/app/src/Entity/News.php @@ -0,0 +1,230 @@ +<?php + +namespace App\Entity; + +use App\Repository\NewsRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; +use Doctrine\DBAL\Types\Types; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: NewsRepository::class)] +class News +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(length: 255)] + private ?string $code = null; + + #[ORM\Column] + private ?bool $active = null; + + #[ORM\Column] + private ?\DateTimeImmutable $create_at = null; + + #[ORM\Column(type: Types::DATETIME_MUTABLE)] + private ?\DateTimeInterface $update_at = null; + + #[ORM\Column] + private ?int $sort = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $preview_image = null; + + #[ORM\Column(length: 1000, nullable: true)] + private ?string $detail_image = null; + + #[ORM\Column(length: 1000, nullable: true)] + private ?string $preview_text = null; + + #[ORM\Column(length: 1000, nullable: true)] + private ?string $detail_test = null; + + #[ORM\ManyToOne(inversedBy: 'news_id')] + #[ORM\JoinColumn(nullable: false)] + private ?NewsType $type_id = null; + + #[ORM\Column] + private ?bool $main_page_render = null; + + /** + * @var Collection<int, NewsComments> + */ + #[ORM\OneToMany(targetEntity: NewsComments::class, mappedBy: 'news_id')] + private Collection $news_comments_id; + + public function __construct() + { + $this->news_comments_id = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(string $code): static + { + $this->code = $code; + + return $this; + } + + public function isActive(): ?bool + { + return $this->active; + } + + public function setActive(bool $active): static + { + $this->active = $active; + + return $this; + } + + public function getCreateAt(): ?\DateTimeImmutable + { + return $this->create_at; + } + + public function setCreateAt(\DateTimeImmutable $create_at): static + { + $this->create_at = $create_at; + + return $this; + } + + public function getUpdateAt(): ?\DateTimeInterface + { + return $this->update_at; + } + + public function setUpdateAt(\DateTimeInterface $update_at): static + { + $this->update_at = $update_at; + + return $this; + } + + public function getSort(): ?int + { + return $this->sort; + } + + public function setSort(int $sort): static + { + $this->sort = $sort; + + return $this; + } + + public function getPreviewImage(): ?string + { + return $this->preview_image; + } + + public function setPreviewImage(?string $preview_image): static + { + $this->preview_image = $preview_image; + + return $this; + } + + public function getDetailImage(): ?string + { + return $this->detail_image; + } + + public function setDetailImage(?string $detail_image): static + { + $this->detail_image = $detail_image; + + return $this; + } + + public function getPreviewText(): ?string + { + return $this->preview_text; + } + + public function setPreviewText(?string $preview_text): static + { + $this->preview_text = $preview_text; + + return $this; + } + + public function getDetailTest(): ?string + { + return $this->detail_test; + } + + public function setDetailTest(?string $detail_test): static + { + $this->detail_test = $detail_test; + + return $this; + } + + public function getTypeId(): ?NewsType + { + return $this->type_id; + } + + public function setTypeId(?NewsType $type_id): static + { + $this->type_id = $type_id; + + return $this; + } + + public function isMainPageRender(): ?bool + { + return $this->main_page_render; + } + + public function setMainPageRender(bool $main_page_render): static + { + $this->main_page_render = $main_page_render; + + return $this; + } + + /** + * @return Collection<int, NewsComments> + */ + public function getNewsCommentsId(): Collection + { + return $this->news_comments_id; + } + + public function addNewsCommentsId(NewsComments $newsCommentsId): static + { + if (!$this->news_comments_id->contains($newsCommentsId)) { + $this->news_comments_id->add($newsCommentsId); + $newsCommentsId->setNewsId($this); + } + + return $this; + } + + public function removeNewsCommentsId(NewsComments $newsCommentsId): static + { + if ($this->news_comments_id->removeElement($newsCommentsId)) { + // set the owning side to null (unless already changed) + if ($newsCommentsId->getNewsId() === $this) { + $newsCommentsId->setNewsId(null); + } + } + + return $this; + } +} diff --git a/app/src/Entity/NewsCategories.php b/app/src/Entity/NewsCategories.php new file mode 100644 index 0000000..8d86aa2 --- /dev/null +++ b/app/src/Entity/NewsCategories.php @@ -0,0 +1,50 @@ +<?php + +namespace App\Entity; + +use App\Repository\NewsCategoriesRepository; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: NewsCategoriesRepository::class)] +class NewsCategories +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(length: 255)] + private ?string $name = null; + + #[ORM\Column(length: 255)] + private ?string $code = null; + + public function getId(): ?int + { + return $this->id; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(string $code): static + { + $this->code = $code; + + return $this; + } +} diff --git a/app/src/Entity/NewsComments.php b/app/src/Entity/NewsComments.php new file mode 100644 index 0000000..04dc1a2 --- /dev/null +++ b/app/src/Entity/NewsComments.php @@ -0,0 +1,142 @@ +<?php + +namespace App\Entity; + +use App\Repository\NewsCommentsRepository; +use Doctrine\DBAL\Types\Types; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: NewsCommentsRepository::class)] +class NewsComments +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\ManyToOne(inversedBy: 'news_comments_id')] + #[ORM\JoinColumn(nullable: false)] + private ?News $news_id = null; + + #[ORM\Column(nullable: true)] + private ?bool $moderated = null; + + #[ORM\ManyToOne(inversedBy: 'news_comments_id_moderate')] + private ?Users $moderator_id = null; + + #[ORM\Column(length: 255)] + private ?string $user_name = null; + + #[ORM\ManyToOne(inversedBy: 'news_comments_id_comment')] + private ?Users $user_id = null; + + #[ORM\Column(length: 1000)] + private ?string $test = null; + + #[ORM\Column] + private ?\DateTimeImmutable $create_at = null; + + #[ORM\Column(type: Types::DATETIME_MUTABLE)] + private ?\DateTimeInterface $update_at = null; + + public function getId(): ?int + { + return $this->id; + } + + public function getNewsId(): ?News + { + return $this->news_id; + } + + public function setNewsId(?News $news_id): static + { + $this->news_id = $news_id; + + return $this; + } + + public function isModerated(): ?bool + { + return $this->moderated; + } + + public function setModerated(?bool $moderated): static + { + $this->moderated = $moderated; + + return $this; + } + + public function getModeratorId(): ?Users + { + return $this->moderator_id; + } + + public function setModeratorId(?Users $moderator_id): static + { + $this->moderator_id = $moderator_id; + + return $this; + } + + public function getUserName(): ?string + { + return $this->user_name; + } + + public function setUserName(string $user_name): static + { + $this->user_name = $user_name; + + return $this; + } + + public function getUserId(): ?Users + { + return $this->user_id; + } + + public function setUserId(?Users $user_id): static + { + $this->user_id = $user_id; + + return $this; + } + + public function getTest(): ?string + { + return $this->test; + } + + public function setTest(string $test): static + { + $this->test = $test; + + return $this; + } + + public function getCreateAt(): ?\DateTimeImmutable + { + return $this->create_at; + } + + public function setCreateAt(\DateTimeImmutable $create_at): static + { + $this->create_at = $create_at; + + return $this; + } + + public function getUpdateAt(): ?\DateTimeInterface + { + return $this->update_at; + } + + public function setUpdateAt(\DateTimeInterface $update_at): static + { + $this->update_at = $update_at; + + return $this; + } +} diff --git a/app/src/Entity/NewsType.php b/app/src/Entity/NewsType.php new file mode 100644 index 0000000..2959afb --- /dev/null +++ b/app/src/Entity/NewsType.php @@ -0,0 +1,93 @@ +<?php + +namespace App\Entity; + +use App\Repository\NewsTypeRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: NewsTypeRepository::class)] +class NewsType +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(length: 255)] + private ?string $name = null; + + #[ORM\Column(length: 255)] + private ?string $code = null; + + /** + * @var Collection<int, News> + */ + #[ORM\OneToMany(targetEntity: News::class, mappedBy: 'type_id')] + private Collection $news_id; + + public function __construct() + { + $this->news_id = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(string $code): static + { + $this->code = $code; + + return $this; + } + + /** + * @return Collection<int, News> + */ + public function getNewsId(): Collection + { + return $this->news_id; + } + + public function addNewsId(News $newsId): static + { + if (!$this->news_id->contains($newsId)) { + $this->news_id->add($newsId); + $newsId->setTypeId($this); + } + + return $this; + } + + public function removeNewsId(News $newsId): static + { + if ($this->news_id->removeElement($newsId)) { + // set the owning side to null (unless already changed) + if ($newsId->getTypeId() === $this) { + $newsId->setTypeId(null); + } + } + + return $this; + } +} diff --git a/app/src/Entity/Phone.php b/app/src/Entity/Phone.php new file mode 100644 index 0000000..c808e22 --- /dev/null +++ b/app/src/Entity/Phone.php @@ -0,0 +1,51 @@ +<?php + +namespace App\Entity; + +use App\Repository\PhoneRepository; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: PhoneRepository::class)] +class Phone +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\ManyToOne(inversedBy: 'phones_id')] + #[ORM\JoinColumn(nullable: false)] + private ?Restaurants $restaurant_id = null; + + #[ORM\Column(length: 255)] + private ?string $phone_number = null; + + public function getId(): ?int + { + return $this->id; + } + + public function getRestaurantId(): ?Restaurants + { + return $this->restaurant_id; + } + + public function setRestaurantId(?Restaurants $restaurant_id): static + { + $this->restaurant_id = $restaurant_id; + + return $this; + } + + public function getPhoneNumber(): ?string + { + return $this->phone_number; + } + + public function setPhoneNumber(string $phone_number): static + { + $this->phone_number = $phone_number; + + return $this; + } +} diff --git a/app/src/Entity/RestauranTypes.php b/app/src/Entity/RestauranTypes.php new file mode 100644 index 0000000..a4bb78f --- /dev/null +++ b/app/src/Entity/RestauranTypes.php @@ -0,0 +1,93 @@ +<?php + +namespace App\Entity; + +use App\Repository\RestauranTypesRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: RestauranTypesRepository::class)] +class RestauranTypes +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(length: 255)] + private ?string $name = null; + + #[ORM\Column(length: 255)] + private ?string $code = null; + + /** + * @var Collection<int, Restaurants> + */ + #[ORM\OneToMany(targetEntity: Restaurants::class, mappedBy: 'type_id')] + private Collection $restaurants_id; + + public function __construct() + { + $this->restaurants_id = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(string $code): static + { + $this->code = $code; + + return $this; + } + + /** + * @return Collection<int, Restaurants> + */ + public function getRestaurantsId(): Collection + { + return $this->restaurants_id; + } + + public function addRestaurantsId(Restaurants $restaurantsId): static + { + if (!$this->restaurants_id->contains($restaurantsId)) { + $this->restaurants_id->add($restaurantsId); + $restaurantsId->setTypeId($this); + } + + return $this; + } + + public function removeRestaurantsId(Restaurants $restaurantsId): static + { + if ($this->restaurants_id->removeElement($restaurantsId)) { + // set the owning side to null (unless already changed) + if ($restaurantsId->getTypeId() === $this) { + $restaurantsId->setTypeId(null); + } + } + + return $this; + } +} diff --git a/app/src/Entity/Restaurants.php b/app/src/Entity/Restaurants.php new file mode 100644 index 0000000..2f26637 --- /dev/null +++ b/app/src/Entity/Restaurants.php @@ -0,0 +1,461 @@ +<?php + +namespace App\Entity; + +use App\Repository\RestaurantsRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; +use Doctrine\DBAL\Types\Types; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: RestaurantsRepository::class)] +class Restaurants +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(type: Types::GUID)] + private ?string $uuid = null; + + #[ORM\Column(length: 255)] + private ?string $name = null; + + #[ORM\Column(length: 255)] + private ?string $code = null; + + #[ORM\Column] + private ?bool $active = null; + + #[ORM\Column] + private ?int $sort = null; + + #[ORM\Column] + private ?\DateTimeImmutable $create_at = null; + + #[ORM\Column(type: Types::DATETIME_MUTABLE)] + private ?\DateTimeInterface $update_at = null; + + #[ORM\Column(type: Types::ARRAY)] + private array $coordinates = []; + + #[ORM\ManyToOne(inversedBy: 'restaurants_id')] + #[ORM\JoinColumn(nullable: false)] + private ?RestauranTypes $type_id = null; + + #[ORM\ManyToOne(inversedBy: 'restaurant_id')] + #[ORM\JoinColumn(nullable: false)] + private ?Settlements $settlement_id = null; + + #[ORM\Column(length: 1000, nullable: true)] + private ?string $description = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $recipe = null; + + #[ORM\Column(length: 1000, nullable: true)] + private ?string $recipe_info = null; + + /** + * @var Collection<int, Kitchens> + */ + #[ORM\ManyToMany(targetEntity: Kitchens::class, inversedBy: 'restaurants_id')] + private Collection $kitchens_id; + + /** + * @var Collection<int, Phone> + */ + #[ORM\OneToMany(targetEntity: Phone::class, mappedBy: 'restaurant_id')] + private Collection $phones_id; + + /** + * @var Collection<int, Email> + */ + #[ORM\OneToMany(targetEntity: Email::class, mappedBy: 'restaurant_id')] + private Collection $emails_id; + + /** + * @var Collection<int, Address> + */ + #[ORM\OneToMany(targetEntity: Address::class, mappedBy: 'restaurant_id')] + private Collection $addresses_id; + + /** + * @var Collection<int, Tags> + */ + #[ORM\ManyToMany(targetEntity: Tags::class, mappedBy: 'restaurant_id')] + private Collection $tags_id; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $site = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $preview_image = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $detail_image = null; + + #[ORM\Column(length: 1000, nullable: true)] + private ?string $how_to_find = null; + + public function __construct() + { + $this->kitchens_id = new ArrayCollection(); + $this->phones_id = new ArrayCollection(); + $this->emails_id = new ArrayCollection(); + $this->addresses_id = new ArrayCollection(); + $this->tags_id = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getUuid(): ?string + { + return $this->uuid; + } + + public function setUuid(string $uuid): static + { + $this->uuid = $uuid; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(string $code): static + { + $this->code = $code; + + return $this; + } + + public function isActive(): ?bool + { + return $this->active; + } + + public function setActive(bool $active): static + { + $this->active = $active; + + return $this; + } + + public function getSort(): ?int + { + return $this->sort; + } + + public function setSort(int $sort): static + { + $this->sort = $sort; + + return $this; + } + + public function getCreateAt(): ?\DateTimeImmutable + { + return $this->create_at; + } + + public function setCreateAt(\DateTimeImmutable $create_at): static + { + $this->create_at = $create_at; + + return $this; + } + + public function getUpdateAt(): ?\DateTimeInterface + { + return $this->update_at; + } + + public function setUpdateAt(\DateTimeInterface $update_at): static + { + $this->update_at = $update_at; + + return $this; + } + + public function getCoordinates(): array + { + return $this->coordinates; + } + + public function setCoordinates(array $coordinates): static + { + $this->coordinates = $coordinates; + + return $this; + } + + public function getTypeId(): ?RestauranTypes + { + return $this->type_id; + } + + public function setTypeId(?RestauranTypes $type_id): static + { + $this->type_id = $type_id; + + return $this; + } + + public function getSettlementId(): ?Settlements + { + return $this->settlement_id; + } + + public function setSettlementId(?Settlements $settlement_id): static + { + $this->settlement_id = $settlement_id; + + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): static + { + $this->description = $description; + + return $this; + } + + public function getRecipe(): ?string + { + return $this->recipe; + } + + public function setRecipe(?string $recipe): static + { + $this->recipe = $recipe; + + return $this; + } + + public function getRecipeInfo(): ?string + { + return $this->recipe_info; + } + + public function setRecipeInfo(string $recipe_info): static + { + $this->recipe_info = $recipe_info; + + return $this; + } + + /** + * @return Collection<int, Kitchens> + */ + public function getKitchensId(): Collection + { + return $this->kitchens_id; + } + + public function addKitchensId(Kitchens $kitchensId): static + { + if (!$this->kitchens_id->contains($kitchensId)) { + $this->kitchens_id->add($kitchensId); + } + + return $this; + } + + public function removeKitchensId(Kitchens $kitchensId): static + { + $this->kitchens_id->removeElement($kitchensId); + + return $this; + } + + /** + * @return Collection<int, Phone> + */ + public function getPhonesId(): Collection + { + return $this->phones_id; + } + + public function addPhonesId(Phone $phonesId): static + { + if (!$this->phones_id->contains($phonesId)) { + $this->phones_id->add($phonesId); + $phonesId->setRestaurantId($this); + } + + return $this; + } + + public function removePhonesId(Phone $phonesId): static + { + if ($this->phones_id->removeElement($phonesId)) { + // set the owning side to null (unless already changed) + if ($phonesId->getRestaurantId() === $this) { + $phonesId->setRestaurantId(null); + } + } + + return $this; + } + + /** + * @return Collection<int, Email> + */ + public function getEmailsId(): Collection + { + return $this->emails_id; + } + + public function addEmailsId(Email $emailsId): static + { + if (!$this->emails_id->contains($emailsId)) { + $this->emails_id->add($emailsId); + $emailsId->setRestaurantId($this); + } + + return $this; + } + + public function removeEmailsId(Email $emailsId): static + { + if ($this->emails_id->removeElement($emailsId)) { + // set the owning side to null (unless already changed) + if ($emailsId->getRestaurantId() === $this) { + $emailsId->setRestaurantId(null); + } + } + + return $this; + } + + /** + * @return Collection<int, Address> + */ + public function getAddressesId(): Collection + { + return $this->addresses_id; + } + + public function addAddressesId(Address $addressesId): static + { + if (!$this->addresses_id->contains($addressesId)) { + $this->addresses_id->add($addressesId); + $addressesId->setRestaurantId($this); + } + + return $this; + } + + public function removeAddressesId(Address $addressesId): static + { + if ($this->addresses_id->removeElement($addressesId)) { + // set the owning side to null (unless already changed) + if ($addressesId->getRestaurantId() === $this) { + $addressesId->setRestaurantId(null); + } + } + + return $this; + } + + /** + * @return Collection<int, Tags> + */ + public function getTagsId(): Collection + { + return $this->tags_id; + } + + public function addTagsId(Tags $tagsId): static + { + if (!$this->tags_id->contains($tagsId)) { + $this->tags_id->add($tagsId); + $tagsId->addRestaurantId($this); + } + + return $this; + } + + public function removeTagsId(Tags $tagsId): static + { + if ($this->tags_id->removeElement($tagsId)) { + $tagsId->removeRestaurantId($this); + } + + return $this; + } + + public function getSite(): ?string + { + return $this->site; + } + + public function setSite(?string $site): static + { + $this->site = $site; + + return $this; + } + + public function getPreviewImage(): ?string + { + return $this->preview_image; + } + + public function setPreviewImage(?string $preview_image): static + { + $this->preview_image = $preview_image; + + return $this; + } + + public function getDetailImage(): ?string + { + return $this->detail_image; + } + + public function setDetailImage(string $detail_image): static + { + $this->detail_image = $detail_image; + + return $this; + } + + public function getHowToFind(): ?string + { + return $this->how_to_find; + } + + public function setHowToFind(?string $how_to_find): static + { + $this->how_to_find = $how_to_find; + + return $this; + } +} + diff --git a/app/src/Entity/Settlements.php b/app/src/Entity/Settlements.php new file mode 100644 index 0000000..2f32614 --- /dev/null +++ b/app/src/Entity/Settlements.php @@ -0,0 +1,154 @@ +<?php + +namespace App\Entity; + +use App\Repository\SettlementsRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; +use Doctrine\DBAL\Types\Types; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: SettlementsRepository::class)] +class Settlements +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(type: Types::GUID)] + private ?string $uuid = null; + + #[ORM\Column(length: 255)] + private ?string $name = null; + + #[ORM\Column(length: 255)] + private ?string $code = null; + + #[ORM\Column(type: Types::ARRAY)] + private array $coordinates = []; + + #[ORM\Column] + private ?\DateTimeImmutable $create_at = null; + + #[ORM\Column(type: Types::DATETIME_MUTABLE)] + private ?\DateTimeInterface $update_at = null; + + /** + * @var Collection<int, Restaurants> + */ + #[ORM\OneToMany(targetEntity: Restaurants::class, mappedBy: 'settlement_id')] + private Collection $restaurant_id; + + public function __construct() + { + $this->restaurant_id = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getUuid(): ?string + { + return $this->uuid; + } + + public function setUuid(string $uuid): static + { + $this->uuid = $uuid; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(string $code): static + { + $this->code = $code; + + return $this; + } + + public function getCoordinates(): array + { + return $this->coordinates; + } + + public function setCoordinates(array $coordinates): static + { + $this->coordinates = $coordinates; + + return $this; + } + + public function getCreateAt(): ?\DateTimeImmutable + { + return $this->create_at; + } + + public function setCreateAt(\DateTimeImmutable $create_at): static + { + $this->create_at = $create_at; + + return $this; + } + + public function getUpdateAt(): ?\DateTimeInterface + { + return $this->update_at; + } + + public function setUpdateAt(\DateTimeInterface $update_at): static + { + $this->update_at = $update_at; + + return $this; + } + + /** + * @return Collection<int, Restaurants> + */ + public function getRestaurantId(): Collection + { + return $this->restaurant_id; + } + + public function addRestaurantId(Restaurants $restaurantId): static + { + if (!$this->restaurant_id->contains($restaurantId)) { + $this->restaurant_id->add($restaurantId); + $restaurantId->setSettlementId($this); + } + + return $this; + } + + public function removeRestaurantId(Restaurants $restaurantId): static + { + if ($this->restaurant_id->removeElement($restaurantId)) { + // set the owning side to null (unless already changed) + if ($restaurantId->getSettlementId() === $this) { + $restaurantId->setSettlementId(null); + } + } + + return $this; + } +} diff --git a/app/src/Entity/Tags.php b/app/src/Entity/Tags.php new file mode 100644 index 0000000..ceb5f6a --- /dev/null +++ b/app/src/Entity/Tags.php @@ -0,0 +1,72 @@ +<?php + +namespace App\Entity; + +use App\Repository\TagsRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: TagsRepository::class)] +class Tags +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + /** + * @var Collection<int, Restaurants> + */ + #[ORM\ManyToMany(targetEntity: Restaurants::class, inversedBy: 'tags_id')] + private Collection $restaurant_id; + + #[ORM\Column(length: 255)] + private ?string $name = null; + + public function __construct() + { + $this->restaurant_id = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + /** + * @return Collection<int, Restaurants> + */ + public function getRestaurantId(): Collection + { + return $this->restaurant_id; + } + + public function addRestaurantId(Restaurants $restaurantId): static + { + if (!$this->restaurant_id->contains($restaurantId)) { + $this->restaurant_id->add($restaurantId); + } + + return $this; + } + + public function removeRestaurantId(Restaurants $restaurantId): static + { + $this->restaurant_id->removeElement($restaurantId); + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } +} diff --git a/app/src/Entity/Users.php b/app/src/Entity/Users.php new file mode 100644 index 0000000..e76741d --- /dev/null +++ b/app/src/Entity/Users.php @@ -0,0 +1,221 @@ +<?php + +namespace App\Entity; + +use App\Repository\UsersRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; +use Doctrine\DBAL\Types\Types; +use Doctrine\ORM\Mapping as ORM; + +#[ORM\Entity(repositoryClass: UsersRepository::class)] +class Users +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + private ?int $id = null; + + #[ORM\Column(type: Types::GUID)] + private ?string $uuid = null; + + #[ORM\Column(length: 255)] + private ?string $name = null; + + #[ORM\Column] + private ?bool $isMale = null; + + #[ORM\Column(nullable: true)] + private ?\DateTimeImmutable $birthDay = null; + + #[ORM\Column(length: 255)] + private ?string $�ф�address = null; + + #[ORM\Column(length: 255)] + private ?string $surname = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $phone_number = null; + + #[ORM\Column(length: 255, nullable: true)] + private ?string $email = null; + + /** + * @var Collection<int, NewsComments> + */ + #[ORM\OneToMany(targetEntity: NewsComments::class, mappedBy: 'moderator_id')] + private Collection $news_comments_id_moderate; + + /** + * @var Collection<int, NewsComments> + */ + #[ORM\OneToMany(targetEntity: NewsComments::class, mappedBy: 'user_id')] + private Collection $news_comments_id_comment; + + public function __construct() + { + $this->news_comments_id_moderate = new ArrayCollection(); + $this->news_comments_id_comment = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getUuid(): ?string + { + return $this->uuid; + } + + public function setUuid(string $uuid): static + { + $this->uuid = $uuid; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } + + public function isMale(): ?bool + { + return $this->isMale; + } + + public function setMale(bool $isMale): static + { + $this->isMale = $isMale; + + return $this; + } + + public function getBirthDay(): ?\DateTimeImmutable + { + return $this->birthDay; + } + + public function setBirthDay(?\DateTimeImmutable $birthDay): static + { + $this->birthDay = $birthDay; + + return $this; + } + + public function get�ф�address(): ?string + { + return $this->�ф�address; + } + + public function set�ф�address(string $�ф�address): static + { + $this->�ф�address = $�ф�address; + + return $this; + } + + public function getSurname(): ?string + { + return $this->surname; + } + + public function setSurname(string $surname): static + { + $this->surname = $surname; + + return $this; + } + + public function getPhoneNumber(): ?string + { + return $this->phone_number; + } + + public function setPhoneNumber(?string $phone_number): static + { + $this->phone_number = $phone_number; + + return $this; + } + + public function getEmail(): ?string + { + return $this->email; + } + + public function setEmail(?string $email): static + { + $this->email = $email; + + return $this; + } + + /** + * @return Collection<int, NewsComments> + */ + public function getNewsCommentsIdModerate(): Collection + { + return $this->news_comments_id_moderate; + } + + public function addNewsCommentsIdModerate(NewsComments $newsCommentsIdModerate): static + { + if (!$this->news_comments_id_moderate->contains($newsCommentsIdModerate)) { + $this->news_comments_id_moderate->add($newsCommentsIdModerate); + $newsCommentsIdModerate->setModeratorId($this); + } + + return $this; + } + + public function removeNewsCommentsIdModerate(NewsComments $newsCommentsIdModerate): static + { + if ($this->news_comments_id_moderate->removeElement($newsCommentsIdModerate)) { + // set the owning side to null (unless already changed) + if ($newsCommentsIdModerate->getModeratorId() === $this) { + $newsCommentsIdModerate->setModeratorId(null); + } + } + + return $this; + } + + /** + * @return Collection<int, NewsComments> + */ + public function getNewsCommentsIdComment(): Collection + { + return $this->news_comments_id_comment; + } + + public function addNewsCommentsIdComment(NewsComments $newsCommentsIdComment): static + { + if (!$this->news_comments_id_comment->contains($newsCommentsIdComment)) { + $this->news_comments_id_comment->add($newsCommentsIdComment); + $newsCommentsIdComment->setUserId($this); + } + + return $this; + } + + public function removeNewsCommentsIdComment(NewsComments $newsCommentsIdComment): static + { + if ($this->news_comments_id_comment->removeElement($newsCommentsIdComment)) { + // set the owning side to null (unless already changed) + if ($newsCommentsIdComment->getUserId() === $this) { + $newsCommentsIdComment->setUserId(null); + } + } + + return $this; + } +} diff --git a/app/src/Repository/AddressRepository.php b/app/src/Repository/AddressRepository.php new file mode 100644 index 0000000..e87117f --- /dev/null +++ b/app/src/Repository/AddressRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\Address; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Address> + * + * @method Address|null find($id, $lockMode = null, $lockVersion = null) + * @method Address|null findOneBy(array $criteria, array $orderBy = null) + * @method Address[] findAll() + * @method Address[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class AddressRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Address::class); + } + +// /** +// * @return Address[] Returns an array of Address objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('a') +// ->andWhere('a.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('a.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Address +// { +// return $this->createQueryBuilder('a') +// ->andWhere('a.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/EmailRepository.php b/app/src/Repository/EmailRepository.php new file mode 100644 index 0000000..f22b0ee --- /dev/null +++ b/app/src/Repository/EmailRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\Email; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Email> + * + * @method Email|null find($id, $lockMode = null, $lockVersion = null) + * @method Email|null findOneBy(array $criteria, array $orderBy = null) + * @method Email[] findAll() + * @method Email[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class EmailRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Email::class); + } + +// /** +// * @return Email[] Returns an array of Email objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('e') +// ->andWhere('e.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('e.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Email +// { +// return $this->createQueryBuilder('e') +// ->andWhere('e.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/KitchensRepository.php b/app/src/Repository/KitchensRepository.php new file mode 100644 index 0000000..47ef7fa --- /dev/null +++ b/app/src/Repository/KitchensRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\Kitchens; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Kitchens> + * + * @method Kitchens|null find($id, $lockMode = null, $lockVersion = null) + * @method Kitchens|null findOneBy(array $criteria, array $orderBy = null) + * @method Kitchens[] findAll() + * @method Kitchens[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class KitchensRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Kitchens::class); + } + +// /** +// * @return Kitchens[] Returns an array of Kitchens objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('k') +// ->andWhere('k.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('k.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Kitchens +// { +// return $this->createQueryBuilder('k') +// ->andWhere('k.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/NewsCategoriesRepository.php b/app/src/Repository/NewsCategoriesRepository.php new file mode 100644 index 0000000..46c102e --- /dev/null +++ b/app/src/Repository/NewsCategoriesRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\NewsCategories; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<NewsCategories> + * + * @method NewsCategories|null find($id, $lockMode = null, $lockVersion = null) + * @method NewsCategories|null findOneBy(array $criteria, array $orderBy = null) + * @method NewsCategories[] findAll() + * @method NewsCategories[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class NewsCategoriesRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, NewsCategories::class); + } + +// /** +// * @return NewsCategories[] Returns an array of NewsCategories objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('n') +// ->andWhere('n.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('n.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?NewsCategories +// { +// return $this->createQueryBuilder('n') +// ->andWhere('n.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/NewsCommentsRepository.php b/app/src/Repository/NewsCommentsRepository.php new file mode 100644 index 0000000..9bf4cd0 --- /dev/null +++ b/app/src/Repository/NewsCommentsRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\NewsComments; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<NewsComments> + * + * @method NewsComments|null find($id, $lockMode = null, $lockVersion = null) + * @method NewsComments|null findOneBy(array $criteria, array $orderBy = null) + * @method NewsComments[] findAll() + * @method NewsComments[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class NewsCommentsRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, NewsComments::class); + } + +// /** +// * @return NewsComments[] Returns an array of NewsComments objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('n') +// ->andWhere('n.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('n.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?NewsComments +// { +// return $this->createQueryBuilder('n') +// ->andWhere('n.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/NewsRepository.php b/app/src/Repository/NewsRepository.php new file mode 100644 index 0000000..3b5d864 --- /dev/null +++ b/app/src/Repository/NewsRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\News; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<News> + * + * @method News|null find($id, $lockMode = null, $lockVersion = null) + * @method News|null findOneBy(array $criteria, array $orderBy = null) + * @method News[] findAll() + * @method News[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class NewsRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, News::class); + } + +// /** +// * @return News[] Returns an array of News objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('n') +// ->andWhere('n.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('n.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?News +// { +// return $this->createQueryBuilder('n') +// ->andWhere('n.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/NewsTypeRepository.php b/app/src/Repository/NewsTypeRepository.php new file mode 100644 index 0000000..385998b --- /dev/null +++ b/app/src/Repository/NewsTypeRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\NewsType; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<NewsType> + * + * @method NewsType|null find($id, $lockMode = null, $lockVersion = null) + * @method NewsType|null findOneBy(array $criteria, array $orderBy = null) + * @method NewsType[] findAll() + * @method NewsType[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class NewsTypeRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, NewsType::class); + } + +// /** +// * @return NewsType[] Returns an array of NewsType objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('n') +// ->andWhere('n.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('n.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?NewsType +// { +// return $this->createQueryBuilder('n') +// ->andWhere('n.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/PhoneRepository.php b/app/src/Repository/PhoneRepository.php new file mode 100644 index 0000000..de389d6 --- /dev/null +++ b/app/src/Repository/PhoneRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\Phone; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Phone> + * + * @method Phone|null find($id, $lockMode = null, $lockVersion = null) + * @method Phone|null findOneBy(array $criteria, array $orderBy = null) + * @method Phone[] findAll() + * @method Phone[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class PhoneRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Phone::class); + } + +// /** +// * @return Phone[] Returns an array of Phone objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('p') +// ->andWhere('p.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('p.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Phone +// { +// return $this->createQueryBuilder('p') +// ->andWhere('p.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/RestauranTypesRepository.php b/app/src/Repository/RestauranTypesRepository.php new file mode 100644 index 0000000..fd67ecb --- /dev/null +++ b/app/src/Repository/RestauranTypesRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\RestauranTypes; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<RestauranTypes> + * + * @method RestauranTypes|null find($id, $lockMode = null, $lockVersion = null) + * @method RestauranTypes|null findOneBy(array $criteria, array $orderBy = null) + * @method RestauranTypes[] findAll() + * @method RestauranTypes[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class RestauranTypesRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, RestauranTypes::class); + } + +// /** +// * @return RestauranTypes[] Returns an array of RestauranTypes objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('r') +// ->andWhere('r.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('r.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?RestauranTypes +// { +// return $this->createQueryBuilder('r') +// ->andWhere('r.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/RestaurantsRepository.php b/app/src/Repository/RestaurantsRepository.php new file mode 100644 index 0000000..f540695 --- /dev/null +++ b/app/src/Repository/RestaurantsRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\Restaurants; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Restaurants> + * + * @method Restaurants|null find($id, $lockMode = null, $lockVersion = null) + * @method Restaurants|null findOneBy(array $criteria, array $orderBy = null) + * @method Restaurants[] findAll() + * @method Restaurants[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class RestaurantsRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Restaurants::class); + } + +// /** +// * @return Restaurants[] Returns an array of Restaurants objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('r') +// ->andWhere('r.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('r.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Restaurants +// { +// return $this->createQueryBuilder('r') +// ->andWhere('r.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/SettlementsRepository.php b/app/src/Repository/SettlementsRepository.php new file mode 100644 index 0000000..ff6673b --- /dev/null +++ b/app/src/Repository/SettlementsRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\Settlements; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Settlements> + * + * @method Settlements|null find($id, $lockMode = null, $lockVersion = null) + * @method Settlements|null findOneBy(array $criteria, array $orderBy = null) + * @method Settlements[] findAll() + * @method Settlements[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class SettlementsRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Settlements::class); + } + +// /** +// * @return Settlements[] Returns an array of Settlements objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('s') +// ->andWhere('s.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('s.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Settlements +// { +// return $this->createQueryBuilder('s') +// ->andWhere('s.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/TagsRepository.php b/app/src/Repository/TagsRepository.php new file mode 100644 index 0000000..4f01463 --- /dev/null +++ b/app/src/Repository/TagsRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\Tags; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Tags> + * + * @method Tags|null find($id, $lockMode = null, $lockVersion = null) + * @method Tags|null findOneBy(array $criteria, array $orderBy = null) + * @method Tags[] findAll() + * @method Tags[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class TagsRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Tags::class); + } + +// /** +// * @return Tags[] Returns an array of Tags objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('t') +// ->andWhere('t.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('t.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Tags +// { +// return $this->createQueryBuilder('t') +// ->andWhere('t.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/src/Repository/UsersRepository.php b/app/src/Repository/UsersRepository.php new file mode 100644 index 0000000..c794b38 --- /dev/null +++ b/app/src/Repository/UsersRepository.php @@ -0,0 +1,48 @@ +<?php + +namespace App\Repository; + +use App\Entity\Users; +use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\Persistence\ManagerRegistry; + +/** + * @extends ServiceEntityRepository<Users> + * + * @method Users|null find($id, $lockMode = null, $lockVersion = null) + * @method Users|null findOneBy(array $criteria, array $orderBy = null) + * @method Users[] findAll() + * @method Users[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class UsersRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, Users::class); + } + +// /** +// * @return Users[] Returns an array of Users objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('u') +// ->andWhere('u.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('u.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?Users +// { +// return $this->createQueryBuilder('u') +// ->andWhere('u.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/app/templates/news_types/index.html.twig b/app/templates/news_types/index.html.twig new file mode 100644 index 0000000..310cc3a --- /dev/null +++ b/app/templates/news_types/index.html.twig @@ -0,0 +1,20 @@ +{% extends 'base.html.twig' %} + +{% block title %}Hello NewsTypesController!{% endblock %} + +{% block body %} +<style> + .example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; } + .example-wrapper code { background: #F5F5F5; padding: 2px 6px; } +</style> + +<div class="example-wrapper"> + <h1>Hello {{ controller_name }}! ✅</h1> + + This friendly message is coming from: + <ul> + <li>Your controller at <code>/home/tamanit/myProj/iqdevTranningProgram/app/src/Controller/NewsTypesController.php</code></li> + <li>Your template at <code>/home/tamanit/myProj/iqdevTranningProgram/app/templates/news_types/index.html.twig</code></li> + </ul> +</div> +{% endblock %} diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3b3b271..111db6b 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,11 +1,21 @@ version: '3.1' services: + app: + build: + context: ../ + dockerfile: docker/php/Dockerfile + networks: + - app + depends_on: + - db + db: image: postgres:16.2 environment: POSTGRES_PASSWORD: ${DATABASE_PASSWORD} POSTGRES_USER: ${DATABASE_USER} + POSTGRES_DB: ${DATABASE_NAME} networks: - app ports: @@ -25,15 +35,6 @@ services: depends_on: - app - app: - build: - context: ../ - dockerfile: docker/php/Dockerfile - networks: - - app - depends_on: - - db - networks: app: driver: bridge \ No newline at end of file -- GitLab