From e4fe75fa97dbf45fc8447ecaf9526494493bb913 Mon Sep 17 00:00:00 2001 From: "a.shamavov" <a.shamavov@iqdev.digital> Date: Wed, 24 Apr 2024 10:36:45 +0500 Subject: [PATCH] =?UTF-8?q?STA-966=20|=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5=D0=B9?= =?UTF-8?q?=D1=81=D1=8B=20=D1=80=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=B5=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- composer.json | 3 + composer.lock | 458 +++++++++++++++++++- config/bundles.php | 2 + docker-compose.yaml | 2 +- migrations/Version20240423071100.php | 103 ----- migrations/Version20240423071601.php | 40 -- src/DataFixtures/AppFixtures.php | 17 + src/DataFixtures/NewsDataFixtures.php | 48 ++ src/DataFixtures/RestaurantDataFixtures.php | 75 ++++ src/Entity/News.php | 6 + src/Entity/NewsCategory.php | 7 +- src/Model/KitchenType.php | 9 +- src/Model/NewsFilterVariants.php | 2 +- src/Model/NewsList.php | 2 +- src/Model/RestaurantDetailElement.php | 2 +- src/Model/RestaurantFilterVariants.php | 2 +- src/Model/RestaurantList.php | 3 +- src/Model/Tag.php | 2 +- src/Repository/KitchenRepository.php | 31 +- src/Repository/RestaurantRepository.php | 31 +- src/Repository/RestaurantTypeRepository.php | 31 +- symfony.lock | 25 ++ 23 files changed, 667 insertions(+), 236 deletions(-) delete mode 100644 migrations/Version20240423071100.php delete mode 100644 migrations/Version20240423071601.php create mode 100644 src/DataFixtures/AppFixtures.php create mode 100644 src/DataFixtures/NewsDataFixtures.php create mode 100644 src/DataFixtures/RestaurantDataFixtures.php diff --git a/.env b/.env index 0a0d6c5..687a18b 100644 --- a/.env +++ b/.env @@ -26,7 +26,7 @@ APP_SECRET=ea3ebbf899855d483050e0d1aad6a759 # DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" # DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" -DATABASE_URL="postgresql://postgres:12345@127.0.0.1:5433/postgres?serverVersion=16&charset=utf8" +DATABASE_URL="postgresql://postgres:12345@postgres/postgres?serverVersion=16&charset=utf8" ###< doctrine/doctrine-bundle ### ###> symfony/messenger ### diff --git a/composer.json b/composer.json index b4e8fa8..fbf9fbc 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,10 @@ "doctrine/doctrine-bundle": "^2.12", "doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/orm": "^3.1", + "nelmio/api-doc-bundle": "^4.26", "phpdocumentor/reflection-docblock": "^5.3", "phpstan/phpdoc-parser": "^1.28", + "ramsey/collection": "^2.0", "symfony/asset": "7.0.*", "symfony/asset-mapper": "7.0.*", "symfony/console": "7.0.*", @@ -97,6 +99,7 @@ } }, "require-dev": { + "doctrine/doctrine-fixtures-bundle": "*", "phpunit/phpunit": "^9.5", "symfony/browser-kit": "7.0.*", "symfony/css-selector": "7.0.*", diff --git a/composer.lock b/composer.lock index 45f3c97..ec268ac 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b1f7459f48c910e2a39af6ee5a9b80eb", + "content-hash": "b57c193bd8eed3bbe092186cd3648c51", "packages": [ { "name": "composer/semver", @@ -1474,6 +1474,121 @@ ], "time": "2024-04-12T21:02:21+00:00" }, + { + "name": "nelmio/api-doc-bundle", + "version": "v4.26.1", + "source": { + "type": "git", + "url": "https://github.com/nelmio/NelmioApiDocBundle.git", + "reference": "2af8c5d55d48c488ef1a650b9ef7133e3c583623" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nelmio/NelmioApiDocBundle/zipball/2af8c5d55d48c488ef1a650b9ef7133e3c583623", + "reference": "2af8c5d55d48c488ef1a650b9ef7133e3c583623", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.4", + "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0", + "phpdocumentor/type-resolver": "^1.8.2", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "psr/container": "^1.0 || ^2.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "symfony/config": "^5.4 || ^6.0 || ^7.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0", + "symfony/deprecation-contracts": "^2.1 || ^3", + "symfony/framework-bundle": "^5.4.24 || ^6.0 || ^7.0", + "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/property-info": "^5.4.10 || ^6.0 || ^7.0", + "symfony/routing": "^5.4 || ^6.0 || ^7.0", + "zircote/swagger-php": "^4.6.1" + }, + "conflict": { + "zircote/swagger-php": "4.8.7" + }, + "require-dev": { + "api-platform/core": "^2.7.0 || ^3", + "composer/package-versions-deprecated": "1.11.99.1", + "doctrine/annotations": "^2.0", + "friendsofphp/php-cs-fixer": "^3.52", + "friendsofsymfony/rest-bundle": "^2.8 || ^3.0", + "jms/serializer": "^1.14 || ^3.0", + "jms/serializer-bundle": "^2.3 || ^3.0 || ^4.0 || ^5.0", + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-phpunit": "^1.3", + "phpstan/phpstan-strict-rules": "^1.5", + "phpstan/phpstan-symfony": "^1.3", + "phpunit/phpunit": "^9.6 || ^10.5", + "symfony/asset": "^5.4 || ^6.0 || ^7.0", + "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0", + "symfony/cache": "^5.4 || ^6.0 || ^7.0", + "symfony/dom-crawler": "^5.4 || ^6.0 || ^7.0", + "symfony/expression-language": "^5.4 || ^6.0 || ^7.0", + "symfony/form": "^5.4 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^6.4", + "symfony/property-access": "^5.4 || ^6.0 || ^7.0", + "symfony/security-csrf": "^5.4 || ^6.0 || ^7.0", + "symfony/serializer": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0", + "symfony/templating": "^5.4 || ^6.0 || ^7.0", + "symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0", + "symfony/validator": "^5.4 || ^6.0 || ^7.0", + "willdurand/hateoas-bundle": "^1.0 || ^2.0" + }, + "suggest": { + "api-platform/core": "For using an API oriented framework.", + "doctrine/annotations": "For using doctrine annotations", + "friendsofsymfony/rest-bundle": "For using the parameters annotations.", + "jms/serializer-bundle": "For describing your models.", + "symfony/asset": "For using the Swagger UI.", + "symfony/cache": "For using a PSR-6 compatible cache implementation with the API doc generator.", + "symfony/form": "For describing your form type models.", + "symfony/monolog-bundle": "For using a PSR-3 compatible logger implementation with the API PHP describer.", + "symfony/security-csrf": "For using csrf protection tokens in forms.", + "symfony/serializer": "For describing your models.", + "symfony/twig-bundle": "For using the Swagger UI.", + "symfony/validator": "For describing the validation constraints in your models.", + "willdurand/hateoas-bundle": "For extracting HATEOAS metadata." + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Nelmio\\ApiDocBundle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://github.com/nelmio/NelmioApiDocBundle/contributors" + } + ], + "description": "Generates documentation for your REST API from annotations and attributes", + "keywords": [ + "api", + "doc", + "documentation", + "rest" + ], + "support": { + "issues": "https://github.com/nelmio/NelmioApiDocBundle/issues", + "source": "https://github.com/nelmio/NelmioApiDocBundle/tree/v4.26.1" + }, + "time": "2024-04-20T11:19:38+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -2002,6 +2117,95 @@ }, "time": "2021-07-14T16:46:02+00:00" }, + { + "name": "ramsey/collection", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/ramsey/collection.git", + "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/collection/zipball/a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", + "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "captainhook/plugin-composer": "^5.3", + "ergebnis/composer-normalize": "^2.28.3", + "fakerphp/faker": "^1.21", + "hamcrest/hamcrest-php": "^2.0", + "jangregor/phpstan-prophecy": "^1.0", + "mockery/mockery": "^1.5", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpcsstandards/phpcsutils": "^1.0.0-rc1", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.9", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5", + "psalm/plugin-mockery": "^1.1", + "psalm/plugin-phpunit": "^0.18.4", + "ramsey/coding-standard": "^2.0.3", + "ramsey/conventional-commits": "^1.3", + "vimeo/psalm": "^5.4" + }, + "type": "library", + "extra": { + "captainhook": { + "force-install": true + }, + "ramsey/conventional-commits": { + "configFile": "conventional-commits.json" + } + }, + "autoload": { + "psr-4": { + "Ramsey\\Collection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + } + ], + "description": "A PHP library for representing and manipulating collections.", + "keywords": [ + "array", + "collection", + "hash", + "map", + "queue", + "set" + ], + "support": { + "issues": "https://github.com/ramsey/collection/issues", + "source": "https://github.com/ramsey/collection/tree/2.0.0" + }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", + "type": "tidelift" + } + ], + "time": "2022-12-31T21:50:55+00:00" + }, { "name": "symfony/asset", "version": "v7.0.3", @@ -7590,9 +7794,261 @@ "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, "time": "2022-06-03T18:03:27+00:00" + }, + { + "name": "zircote/swagger-php", + "version": "4.9.0", + "source": { + "type": "git", + "url": "https://github.com/zircote/swagger-php.git", + "reference": "b46a36d006f4db4d761995a5add1e7ab0386ed1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/b46a36d006f4db4d761995a5add1e7ab0386ed1d", + "reference": "b46a36d006f4db4d761995a5add1e7ab0386ed1d", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.2", + "psr/log": "^1.1 || ^2.0 || ^3.0", + "symfony/deprecation-contracts": "^2 || ^3", + "symfony/finder": ">=2.2", + "symfony/yaml": ">=3.3" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11", + "doctrine/annotations": "^1.7 || ^2.0", + "friendsofphp/php-cs-fixer": "^2.17 || ^3.47.1", + "phpstan/phpstan": "^1.6", + "phpunit/phpunit": ">=8", + "vimeo/psalm": "^4.23" + }, + "suggest": { + "doctrine/annotations": "^1.7 || ^2.0" + }, + "bin": [ + "bin/openapi" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "OpenApi\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Robert Allen", + "email": "zircote@gmail.com" + }, + { + "name": "Bob Fanger", + "email": "bfanger@gmail.com", + "homepage": "https://bfanger.nl" + }, + { + "name": "Martin Rademacher", + "email": "mano@radebatz.net", + "homepage": "https://radebatz.net" + } + ], + "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", + "homepage": "https://github.com/zircote/swagger-php/", + "keywords": [ + "api", + "json", + "rest", + "service discovery" + ], + "support": { + "issues": "https://github.com/zircote/swagger-php/issues", + "source": "https://github.com/zircote/swagger-php/tree/4.9.0" + }, + "time": "2024-04-18T22:32:11+00:00" } ], "packages-dev": [ + { + "name": "doctrine/data-fixtures", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/data-fixtures.git", + "reference": "bbcb74f2ac6dbe81a14b3c3687d7623490a0448f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/bbcb74f2ac6dbe81a14b3c3687d7623490a0448f", + "reference": "bbcb74f2ac6dbe81a14b3c3687d7623490a0448f", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^0.5.3 || ^1.0", + "doctrine/persistence": "^2.0|^3.0", + "php": "^7.4 || ^8.0" + }, + "conflict": { + "doctrine/dbal": "<3.5 || >=5", + "doctrine/orm": "<2.14 || >=4", + "doctrine/phpcr-odm": "<1.3.0" + }, + "require-dev": { + "doctrine/annotations": "^1.12 || ^2", + "doctrine/coding-standard": "^12", + "doctrine/dbal": "^3.5 || ^4", + "doctrine/mongodb-odm": "^1.3.0 || ^2.0.0", + "doctrine/orm": "^2.14 || ^3", + "ext-sqlite3": "*", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.6.13 || ^10.4.2", + "symfony/cache": "^5.4 || ^6.3 || ^7", + "symfony/var-exporter": "^5.4 || ^6.3 || ^7", + "vimeo/psalm": "^5.9" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)", + "doctrine/mongodb-odm": "For loading MongoDB ODM fixtures", + "doctrine/orm": "For loading ORM fixtures", + "doctrine/phpcr-odm": "For loading PHPCR ODM fixtures" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\DataFixtures\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Data Fixtures for all Doctrine Object Managers", + "homepage": "https://www.doctrine-project.org", + "keywords": [ + "database" + ], + "support": { + "issues": "https://github.com/doctrine/data-fixtures/issues", + "source": "https://github.com/doctrine/data-fixtures/tree/1.7.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdata-fixtures", + "type": "tidelift" + } + ], + "time": "2023-11-24T11:18:31+00:00" + }, + { + "name": "doctrine/doctrine-fixtures-bundle", + "version": "3.5.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineFixturesBundle.git", + "reference": "c808a0c85c38c8ee265cc8405b456c1d2b38567d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/c808a0c85c38c8ee265cc8405b456c1d2b38567d", + "reference": "c808a0c85c38c8ee265cc8405b456c1d2b38567d", + "shasum": "" + }, + "require": { + "doctrine/data-fixtures": "^1.3", + "doctrine/doctrine-bundle": "^2.2", + "doctrine/orm": "^2.14.0 || ^3.0", + "doctrine/persistence": "^2.4|^3.0", + "php": "^7.4 || ^8.0", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/doctrine-bridge": "^5.4|^6.0|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0" + }, + "conflict": { + "doctrine/dbal": "< 3" + }, + "require-dev": { + "doctrine/coding-standard": "^12", + "phpstan/phpstan": "^1.10.39", + "phpunit/phpunit": "^9.6.13", + "symfony/phpunit-bridge": "^6.3.6", + "vimeo/psalm": "^5.15" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Doctrine\\Bundle\\FixturesBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Doctrine Project", + "homepage": "https://www.doctrine-project.org" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DoctrineFixturesBundle", + "homepage": "https://www.doctrine-project.org", + "keywords": [ + "Fixture", + "persistence" + ], + "support": { + "issues": "https://github.com/doctrine/DoctrineFixturesBundle/issues", + "source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/3.5.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdoctrine-fixtures-bundle", + "type": "tidelift" + } + ], + "time": "2023-11-19T12:48:54+00:00" + }, { "name": "masterminds/html5", "version": "2.9.0", diff --git a/config/bundles.php b/config/bundles.php index 4e3a560..deb909d 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -13,4 +13,6 @@ return [ Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], + Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true], ]; diff --git a/docker-compose.yaml b/docker-compose.yaml index 9a33442..b87becc 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,7 +9,7 @@ services: POSTGRES_PASSWORD: 12345 POSTGRES_HOST_AUTH_METHOD: trust ports: - - "${DATABASE_PORT}:${DATABASE_PORT}" + - "5433:${DATABASE_PORT}" networks: - internal nginx: diff --git a/migrations/Version20240423071100.php b/migrations/Version20240423071100.php deleted file mode 100644 index f16e9f8..0000000 --- a/migrations/Version20240423071100.php +++ /dev/null @@ -1,103 +0,0 @@ -<?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 Version20240423071100 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 news_comment_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 restaurant_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 TABLE address (id INT NOT NULL, restaurant_id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_D4E6F81B1E7706E ON address (restaurant_id)'); - $this->addSql('CREATE TABLE email (id INT NOT NULL, restaurant_id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_E7927C74B1E7706E ON email (restaurant_id)'); - $this->addSql('CREATE TABLE news (id UUID NOT NULL, type_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) NOT NULL, detail_image VARCHAR(255) NOT NULL, preview_text TEXT NOT NULL, detail_text TEXT NOT NULL, main_page_render BOOLEAN NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_1DD39950C54C8C93 ON news (type_id)'); - $this->addSql('COMMENT ON COLUMN news.id IS \'(DC2Type:uuid)\''); - $this->addSql('CREATE TABLE news_comment (id INT NOT NULL, news_id_id UUID NOT NULL, moderator_id_id INT NOT NULL, user_id_id INT NOT NULL, moderated BOOLEAN NOT NULL, user_name VARCHAR(255) NOT NULL, text VARCHAR(255) 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 UNIQUE INDEX UNIQ_C3904E8A5FB1909 ON news_comment (news_id_id)'); - $this->addSql('CREATE INDEX IDX_C3904E8ACEB712DF ON news_comment (moderator_id_id)'); - $this->addSql('CREATE INDEX IDX_C3904E8A9D86650F ON news_comment (user_id_id)'); - $this->addSql('COMMENT ON COLUMN news_comment.news_id_id IS \'(DC2Type:uuid)\''); - $this->addSql('CREATE TABLE news_type (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE phone (id INT NOT NULL, restaurant_id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_444F97DDB1E7706E ON phone (restaurant_id)'); - $this->addSql('CREATE TABLE restaurant (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 TEXT NOT NULL, check_price VARCHAR(255) NOT NULL, check_info TEXT NOT NULL, site VARCHAR(255) NOT NULL, preview_image VARCHAR(255) NOT NULL, detail_image VARCHAR(255) NOT NULL, how_to_find TEXT NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE UNIQUE INDEX UNIQ_EB95123FD17F50A6 ON restaurant (uuid)'); - $this->addSql('CREATE INDEX IDX_EB95123F714819A0 ON restaurant (type_id_id)'); - $this->addSql('CREATE INDEX IDX_EB95123F45EC589B ON restaurant (settlement_id_id)'); - $this->addSql('COMMENT ON COLUMN restaurant.uuid IS \'(DC2Type:uuid)\''); - $this->addSql('COMMENT ON COLUMN restaurant.coordinates IS \'(DC2Type:array)\''); - $this->addSql('CREATE TABLE tags (id INT NOT NULL, restaurant_id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_6FBC9426B1E7706E ON tags (restaurant_id)'); - $this->addSql('ALTER TABLE address ADD CONSTRAINT FK_D4E6F81B1E7706E FOREIGN KEY (restaurant_id) REFERENCES restaurant (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE email ADD CONSTRAINT FK_E7927C74B1E7706E FOREIGN KEY (restaurant_id) REFERENCES restaurant (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950C54C8C93 FOREIGN KEY (type_id) REFERENCES news_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE news_comment ADD CONSTRAINT FK_C3904E8A5FB1909 FOREIGN KEY (news_id_id) REFERENCES news (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE news_comment ADD CONSTRAINT FK_C3904E8ACEB712DF FOREIGN KEY (moderator_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE news_comment ADD CONSTRAINT FK_C3904E8A9D86650F FOREIGN KEY (user_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE phone ADD CONSTRAINT FK_444F97DDB1E7706E FOREIGN KEY (restaurant_id) REFERENCES restaurant (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE restaurant ADD CONSTRAINT FK_EB95123F714819A0 FOREIGN KEY (type_id_id) REFERENCES restaurant_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE restaurant ADD CONSTRAINT FK_EB95123F45EC589B FOREIGN KEY (settlement_id_id) REFERENCES settlement (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE tags ADD CONSTRAINT FK_6FBC9426B1E7706E FOREIGN KEY (restaurant_id) REFERENCES restaurant (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE kitchen ADD restaurant_id INT NOT NULL'); - $this->addSql('ALTER TABLE kitchen ADD CONSTRAINT FK_EAA3CE34B1E7706E FOREIGN KEY (restaurant_id) REFERENCES restaurant (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('CREATE INDEX IDX_EAA3CE34B1E7706E ON kitchen (restaurant_id)'); - $this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649D17F50A6 ON "user" (uuid)'); - } - - 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('ALTER TABLE kitchen DROP CONSTRAINT FK_EAA3CE34B1E7706E'); - $this->addSql('DROP SEQUENCE address_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE email_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE news_comment_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE news_type_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE phone_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE restaurant_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE tags_id_seq CASCADE'); - $this->addSql('ALTER TABLE address DROP CONSTRAINT FK_D4E6F81B1E7706E'); - $this->addSql('ALTER TABLE email DROP CONSTRAINT FK_E7927C74B1E7706E'); - $this->addSql('ALTER TABLE news DROP CONSTRAINT FK_1DD39950C54C8C93'); - $this->addSql('ALTER TABLE news_comment DROP CONSTRAINT FK_C3904E8A5FB1909'); - $this->addSql('ALTER TABLE news_comment DROP CONSTRAINT FK_C3904E8ACEB712DF'); - $this->addSql('ALTER TABLE news_comment DROP CONSTRAINT FK_C3904E8A9D86650F'); - $this->addSql('ALTER TABLE phone DROP CONSTRAINT FK_444F97DDB1E7706E'); - $this->addSql('ALTER TABLE restaurant DROP CONSTRAINT FK_EB95123F714819A0'); - $this->addSql('ALTER TABLE restaurant DROP CONSTRAINT FK_EB95123F45EC589B'); - $this->addSql('ALTER TABLE tags DROP CONSTRAINT FK_6FBC9426B1E7706E'); - $this->addSql('DROP TABLE address'); - $this->addSql('DROP TABLE email'); - $this->addSql('DROP TABLE news'); - $this->addSql('DROP TABLE news_comment'); - $this->addSql('DROP TABLE news_type'); - $this->addSql('DROP TABLE phone'); - $this->addSql('DROP TABLE restaurant'); - $this->addSql('DROP TABLE tags'); - $this->addSql('DROP INDEX UNIQ_8D93D649D17F50A6'); - $this->addSql('DROP INDEX IDX_EAA3CE34B1E7706E'); - $this->addSql('ALTER TABLE kitchen DROP restaurant_id'); - } -} diff --git a/migrations/Version20240423071601.php b/migrations/Version20240423071601.php deleted file mode 100644 index c8b2ca7..0000000 --- a/migrations/Version20240423071601.php +++ /dev/null @@ -1,40 +0,0 @@ -<?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 Version20240423071601 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 TABLE news_news_category (news_id UUID NOT NULL, news_category_id UUID NOT NULL, PRIMARY KEY(news_id, news_category_id))'); - $this->addSql('CREATE INDEX IDX_1A91D6D6B5A459A0 ON news_news_category (news_id)'); - $this->addSql('CREATE INDEX IDX_1A91D6D63B732BAD ON news_news_category (news_category_id)'); - $this->addSql('COMMENT ON COLUMN news_news_category.news_id IS \'(DC2Type:uuid)\''); - $this->addSql('COMMENT ON COLUMN news_news_category.news_category_id IS \'(DC2Type:uuid)\''); - $this->addSql('ALTER TABLE news_news_category ADD CONSTRAINT FK_1A91D6D6B5A459A0 FOREIGN KEY (news_id) REFERENCES news (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE news_news_category ADD CONSTRAINT FK_1A91D6D63B732BAD FOREIGN KEY (news_category_id) REFERENCES news_category (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('ALTER TABLE news_news_category DROP CONSTRAINT FK_1A91D6D6B5A459A0'); - $this->addSql('ALTER TABLE news_news_category DROP CONSTRAINT FK_1A91D6D63B732BAD'); - $this->addSql('DROP TABLE news_news_category'); - } -} diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php new file mode 100644 index 0000000..987f6fe --- /dev/null +++ b/src/DataFixtures/AppFixtures.php @@ -0,0 +1,17 @@ +<?php + +namespace App\DataFixtures; + +use Doctrine\Bundle\FixturesBundle\Fixture; +use Doctrine\Persistence\ObjectManager; + +class AppFixtures extends Fixture +{ + public function load(ObjectManager $manager): void + { + // $product = new Product(); + // $manager->persist($product); + + $manager->flush(); + } +} diff --git a/src/DataFixtures/NewsDataFixtures.php b/src/DataFixtures/NewsDataFixtures.php new file mode 100644 index 0000000..8b1a01a --- /dev/null +++ b/src/DataFixtures/NewsDataFixtures.php @@ -0,0 +1,48 @@ +<?php + +namespace App\DataFixtures; + +use DateTime; +use App\Entity\News; +use App\Entity\NewsType; +use App\Entity\NewsCategory; +use App\Entity\User; +use Doctrine\Bundle\FixturesBundle\Fixture; +use Doctrine\Persistence\ObjectManager; +use Symfony\Component\Uid\Uuid; + +class NewsDataFixtures extends Fixture +{ + public function load(ObjectManager $manager) + { + $newsType = (new NewsType()) + ->setName("СтатьÑ"); + $newsCategory = (new NewsCategory()) + ->setId(Uuid::v4()) + ->setName("Культура") + ->setCode("kultura"); + $user = (new User()) + ->setName("Модератор") + ->setUuid(Uuid::v4()); + $news = (new News()) + ->setId(Uuid::v4()) + ->setSort(1) + ->setActive(true) + ->setDetailImage("/upload/news-detail.jpg") + ->setPreviewImage("/upload/news-preview.jpg") + ->setType($newsType) + ->setCreateAt(new DateTime("23-04-2024")) + ->setCode("yamal-museum") + ->setUpdateAt(new DateTime("23-04-2024")) + ->setDetailText("Ðто Ñамый большой музей на Ямале. ЗдеÑÑŒ вы найдете вÑÑ‘ о жизни региона, традициÑÑ… и обычаÑÑ… народов Ñевера и поÑетите виртуальную выÑтавку, организованную по поÑледнему Ñлову Ñовременных технологий.") + ->setMainPageRender(true) + ->setPreviewText("Два чаÑа на знакомÑтво Ñ Ñ‚Ñ‹ÑÑчелетней иÑторией Ямала.") + ->addNewsCategory($newsCategory); + $manager->persist($newsType); + $manager->persist($newsCategory); + $manager->persist($user); + $manager->persist($news); + $manager->flush(); + + } +} \ No newline at end of file diff --git a/src/DataFixtures/RestaurantDataFixtures.php b/src/DataFixtures/RestaurantDataFixtures.php new file mode 100644 index 0000000..8534031 --- /dev/null +++ b/src/DataFixtures/RestaurantDataFixtures.php @@ -0,0 +1,75 @@ +<?php + +namespace App\DataFixtures; + +use App\Entity\Restaurant; +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 +{ + public function load(ObjectManager $manager) + { + $restaurantType = (new RestaurantType()) + ->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")); + $restaurant = (new Restaurant()) + ->setUuid(Uuid::v4()) + ->setName("РеÑторан «Ðрктика»") + ->setCode("restoran-arktika") + ->setCoordinates([123, 321]) + ->setCreateAt(new DateTime("12-02-2024")) + ->setUpdateAt(new DateTime("09-03-2024")) + ->setActive(true) + ->setCheckPrice("от 1 до 2 || от 1 || до 1000") + ->setCheckInfo("bla bla") + ->setDescription("ОпиÑание реÑторана ОпиÑание реÑторана") + ->setHowToFind("Возле набережной") + ->setPreviewImage("/upload/preview.png") + ->setDetailImage("/upload/detail.png") + ->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); + $kitchen = (new Kitchen()) + ->setName("ÐзиатÑкаÑ") + ->setRestaurant($restaurant); + $tags = (new Tags()) + ->setName("тег1") + ->setRestaurant($restaurant); + $manager->persist($restaurantType); + $manager->persist($settlement); + $manager->persist($restaurant); + $manager->persist($phone); + $manager->persist($email); + $manager->persist($address); + $manager->persist($kitchen); + $manager->persist($tags); + $manager->flush(); + } +} \ No newline at end of file diff --git a/src/Entity/News.php b/src/Entity/News.php index a4de9af..092b75e 100644 --- a/src/Entity/News.php +++ b/src/Entity/News.php @@ -66,6 +66,12 @@ class News return $this->id; } + public function setId(?Uuid $id): static + { + $this->id = $id; + return $this; + } + public function getCode(): ?string { return $this->code; diff --git a/src/Entity/NewsCategory.php b/src/Entity/NewsCategory.php index 974a99c..6190e58 100644 --- a/src/Entity/NewsCategory.php +++ b/src/Entity/NewsCategory.php @@ -3,7 +3,6 @@ namespace App\Entity; use App\Repository\NewsCategoryRepository; -use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Uid\Uuid; @@ -26,6 +25,12 @@ class NewsCategory return $this->id; } + public function setId(?Uuid $id): static + { + $this->id = $id; + return $this; + } + public function getName(): ?string { return $this->name; diff --git a/src/Model/KitchenType.php b/src/Model/KitchenType.php index b9d532b..34e125b 100644 --- a/src/Model/KitchenType.php +++ b/src/Model/KitchenType.php @@ -6,14 +6,12 @@ class KitchenType { private int $id; private string $name; - private string $code; - public function __construct(int $id, string $name, string $code) + public function __construct(int $id, string $name) { $this->id = $id; $this->name = $name; - $this->code = $code; } public function getId(): int @@ -25,9 +23,4 @@ class KitchenType { return $this->name; } - - public function getCode(): string - { - return $this->code; - } } \ No newline at end of file diff --git a/src/Model/NewsFilterVariants.php b/src/Model/NewsFilterVariants.php index 9154ad1..e0a7c97 100644 --- a/src/Model/NewsFilterVariants.php +++ b/src/Model/NewsFilterVariants.php @@ -2,7 +2,7 @@ namespace App\Model; -use Doctrine\Common\Collections\Collection; +use Ramsey\Collection\Collection; class NewsFilterVariants { diff --git a/src/Model/NewsList.php b/src/Model/NewsList.php index 0d53703..ffde5cd 100644 --- a/src/Model/NewsList.php +++ b/src/Model/NewsList.php @@ -2,7 +2,7 @@ namespace App\Model; -use Doctrine\Common\Collections\Collection; +use Ramsey\Collection\Collection; class NewsList { diff --git a/src/Model/RestaurantDetailElement.php b/src/Model/RestaurantDetailElement.php index fc8bbf7..face2bf 100644 --- a/src/Model/RestaurantDetailElement.php +++ b/src/Model/RestaurantDetailElement.php @@ -2,7 +2,7 @@ namespace App\Model; -use Doctrine\Common\Collections\Collection; +use Ramsey\Collection\Collection; class RestaurantDetailElement { diff --git a/src/Model/RestaurantFilterVariants.php b/src/Model/RestaurantFilterVariants.php index 04d31d0..8b158b5 100644 --- a/src/Model/RestaurantFilterVariants.php +++ b/src/Model/RestaurantFilterVariants.php @@ -2,7 +2,7 @@ namespace App\Model; -use Doctrine\Common\Collections\Collection; +use Ramsey\Collection\Collection; class RestaurantFilterVariants { diff --git a/src/Model/RestaurantList.php b/src/Model/RestaurantList.php index 28a6630..4132402 100644 --- a/src/Model/RestaurantList.php +++ b/src/Model/RestaurantList.php @@ -2,7 +2,8 @@ namespace App\Model; -use Doctrine\Common\Collections\Collection; + +use Ramsey\Collection\Collection; class RestaurantList { diff --git a/src/Model/Tag.php b/src/Model/Tag.php index 5c2d1cf..403896e 100644 --- a/src/Model/Tag.php +++ b/src/Model/Tag.php @@ -2,7 +2,7 @@ namespace App\Model; -use phpDocumentor\Reflection\Types\Collection; +use Ramsey\Collection\Collection; class Tag { diff --git a/src/Repository/KitchenRepository.php b/src/Repository/KitchenRepository.php index 745766d..6fef2bc 100644 --- a/src/Repository/KitchenRepository.php +++ b/src/Repository/KitchenRepository.php @@ -3,6 +3,7 @@ namespace App\Repository; use App\Entity\Kitchen; +use App\Repository\Interface\KitchenRepositoryInterface; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; @@ -14,35 +15,15 @@ use Doctrine\Persistence\ManagerRegistry; * @method Kitchen[] findAll() * @method Kitchen[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ -class KitchenRepository extends ServiceEntityRepository +class KitchenRepository extends ServiceEntityRepository implements KitchenRepositoryInterface { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Kitchen::class); } -// /** -// * @return Kitchen[] Returns an array of Kitchen 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): ?Kitchen -// { -// return $this->createQueryBuilder('k') -// ->andWhere('k.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + public function getAll(): array + { + return $this->findAll(); + } } diff --git a/src/Repository/RestaurantRepository.php b/src/Repository/RestaurantRepository.php index 8b5b18d..361489d 100644 --- a/src/Repository/RestaurantRepository.php +++ b/src/Repository/RestaurantRepository.php @@ -3,6 +3,7 @@ namespace App\Repository; use App\Entity\Restaurant; +use App\Repository\Interface\RestaurantRepositoryInterface; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; @@ -14,35 +15,15 @@ use Doctrine\Persistence\ManagerRegistry; * @method Restaurant[] findAll() * @method Restaurant[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ -class RestaurantRepository extends ServiceEntityRepository +class RestaurantRepository extends ServiceEntityRepository implements RestaurantRepositoryInterface { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Restaurant::class); } -// /** -// * @return Restaurant[] Returns an array of Restaurant 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): ?Restaurant -// { -// return $this->createQueryBuilder('r') -// ->andWhere('r.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + public function getAll(): array + { + return $this->findAll(); + } } diff --git a/src/Repository/RestaurantTypeRepository.php b/src/Repository/RestaurantTypeRepository.php index 30e6a42..aa1f621 100644 --- a/src/Repository/RestaurantTypeRepository.php +++ b/src/Repository/RestaurantTypeRepository.php @@ -3,6 +3,7 @@ namespace App\Repository; use App\Entity\RestaurantType; +use App\Repository\Interface\RestaurantTypeRepositoryInterface; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; @@ -14,35 +15,15 @@ use Doctrine\Persistence\ManagerRegistry; * @method RestaurantType[] findAll() * @method RestaurantType[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ -class RestaurantTypeRepository extends ServiceEntityRepository +class RestaurantTypeRepository extends ServiceEntityRepository implements RestaurantTypeRepositoryInterface { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, RestaurantType::class); } -// /** -// * @return RestaurantType[] Returns an array of RestaurantType 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): ?RestaurantType -// { -// return $this->createQueryBuilder('r') -// ->andWhere('r.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + public function getAll(): array + { + return $this->findAll(); + } } diff --git a/symfony.lock b/symfony.lock index f28d08f..922ad45 100644 --- a/symfony.lock +++ b/symfony.lock @@ -13,6 +13,18 @@ "./src/Repository/.gitignore" ] }, + "doctrine/doctrine-fixtures-bundle": { + "version": "3.5", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "3.0", + "ref": "1f5514cfa15b947298df4d771e694e578d4c204d" + }, + "files": [ + "./src/DataFixtures/AppFixtures.php" + ] + }, "doctrine/doctrine-migrations-bundle": { "version": "3.3", "recipe": { @@ -26,6 +38,19 @@ "./migrations/.gitignore" ] }, + "nelmio/api-doc-bundle": { + "version": "4.26", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "3.0", + "ref": "c8e0c38e1a280ab9e37587a8fa32b251d5bc1c94" + }, + "files": [ + "./config/packages/nelmio_api_doc.yaml", + "./config/routes/nelmio_api_doc.yaml" + ] + }, "phpunit/phpunit": { "version": "9.6", "recipe": { -- GitLab