diff --git a/back/.idea/dev.iml b/back/.idea/dev.iml
index 4417b18..c79ca0f 100644
--- a/back/.idea/dev.iml
+++ b/back/.idea/dev.iml
@@ -81,6 +81,13 @@
+
+
+
+
+
+
+
diff --git a/back/.idea/php.xml b/back/.idea/php.xml
index f5bba69..84f51b0 100644
--- a/back/.idea/php.xml
+++ b/back/.idea/php.xml
@@ -88,6 +88,13 @@
+
+
+
+
+
+
+
diff --git a/back/composer.json b/back/composer.json
index b269858..2684186 100644
--- a/back/composer.json
+++ b/back/composer.json
@@ -21,6 +21,7 @@
"symfony/expression-language": "6.2.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "6.2.*",
+ "symfony/mime": "6.2.*",
"symfony/property-access": "6.2.*",
"symfony/property-info": "6.2.*",
"symfony/runtime": "6.2.*",
@@ -77,5 +78,10 @@
"allow-contrib": false,
"require": "6.2.*"
}
+ },
+ "require-dev": {
+ "doctrine/doctrine-fixtures-bundle": "^3.4",
+ "fakerphp/faker": "^1.21",
+ "symfony/maker-bundle": "^1.48"
}
}
diff --git a/back/composer.lock b/back/composer.lock
index 7e1aa5e..68fd0c5 100644
--- a/back/composer.lock
+++ b/back/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": "e6139b56feb1901bdd8f4678726165b5",
+ "content-hash": "64cdd550536b7c7f1585e6af2daef65d",
"packages": [
{
"name": "api-platform/core",
@@ -3825,6 +3825,89 @@
],
"time": "2023-02-01T08:32:25+00:00"
},
+ {
+ "name": "symfony/mime",
+ "version": "v6.2.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/mime.git",
+ "reference": "4b7b349f67d15cd0639955c8179a76c89f6fd610"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/mime/zipball/4b7b349f67d15cd0639955c8179a76c89f6fd610",
+ "reference": "4b7b349f67d15cd0639955c8179a76c89f6fd610",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1",
+ "symfony/polyfill-intl-idn": "^1.10",
+ "symfony/polyfill-mbstring": "^1.0"
+ },
+ "conflict": {
+ "egulias/email-validator": "~3.0.0",
+ "phpdocumentor/reflection-docblock": "<3.2.2",
+ "phpdocumentor/type-resolver": "<1.4.0",
+ "symfony/mailer": "<5.4",
+ "symfony/serializer": "<6.2"
+ },
+ "require-dev": {
+ "egulias/email-validator": "^2.1.10|^3.1|^4",
+ "league/html-to-markdown": "^5.0",
+ "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
+ "symfony/dependency-injection": "^5.4|^6.0",
+ "symfony/property-access": "^5.4|^6.0",
+ "symfony/property-info": "^5.4|^6.0",
+ "symfony/serializer": "^6.2"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Mime\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Allows manipulating MIME messages",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "mime",
+ "mime-type"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/mime/tree/v6.2.5"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2023-01-10T18:53:53+00:00"
+ },
{
"name": "symfony/password-hasher",
"version": "v6.2.5",
@@ -3978,6 +4061,93 @@
],
"time": "2022-11-03T14:55:06+00:00"
},
+ {
+ "name": "symfony/polyfill-intl-idn",
+ "version": "v1.27.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-intl-idn.git",
+ "reference": "639084e360537a19f9ee352433b84ce831f3d2da"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da",
+ "reference": "639084e360537a19f9ee352433b84ce831f3d2da",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1",
+ "symfony/polyfill-intl-normalizer": "^1.10",
+ "symfony/polyfill-php72": "^1.10"
+ },
+ "suggest": {
+ "ext-intl": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.27-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "files": [
+ "bootstrap.php"
+ ],
+ "psr-4": {
+ "Symfony\\Polyfill\\Intl\\Idn\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Laurent Bassin",
+ "email": "laurent@bassin.info"
+ },
+ {
+ "name": "Trevor Rowbotham",
+ "email": "trevor.rowbotham@pm.me"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "idn",
+ "intl",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.27.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-11-03T14:55:06+00:00"
+ },
{
"name": "symfony/polyfill-intl-normalizer",
"version": "v1.27.0",
@@ -6070,7 +6240,390 @@
"time": "2022-01-30T20:08:53+00:00"
}
],
- "packages-dev": [],
+ "packages-dev": [
+ {
+ "name": "doctrine/data-fixtures",
+ "version": "1.6.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/data-fixtures.git",
+ "reference": "c27821d038e64f1bfc852a94064d65d2a75ad01f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/c27821d038e64f1bfc852a94064d65d2a75ad01f",
+ "reference": "c27821d038e64f1bfc852a94064d65d2a75ad01f",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/persistence": "^1.3.3|^2.0|^3.0",
+ "php": "^7.2 || ^8.0"
+ },
+ "conflict": {
+ "doctrine/dbal": "<2.13",
+ "doctrine/orm": "<2.12",
+ "doctrine/phpcr-odm": "<1.3.0"
+ },
+ "require-dev": {
+ "doctrine/coding-standard": "^10.0",
+ "doctrine/dbal": "^2.13 || ^3.0",
+ "doctrine/deprecations": "^1.0",
+ "doctrine/mongodb-odm": "^1.3.0 || ^2.0.0",
+ "doctrine/orm": "^2.12",
+ "ext-sqlite3": "*",
+ "phpstan/phpstan": "^1.5",
+ "phpunit/phpunit": "^8.5 || ^9.5",
+ "symfony/cache": "^5.0 || ^6.0",
+ "vimeo/psalm": "^4.10"
+ },
+ "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\\": "lib/Doctrine/Common/DataFixtures"
+ }
+ },
+ "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.6.3"
+ },
+ "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-01-07T15:10:22+00:00"
+ },
+ {
+ "name": "doctrine/doctrine-fixtures-bundle",
+ "version": "3.4.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/DoctrineFixturesBundle.git",
+ "reference": "601988c5b46dbd20a0f886f967210aba378a6fd5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/601988c5b46dbd20a0f886f967210aba378a6fd5",
+ "reference": "601988c5b46dbd20a0f886f967210aba378a6fd5",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/data-fixtures": "^1.3",
+ "doctrine/doctrine-bundle": "^1.11|^2.0",
+ "doctrine/orm": "^2.6.0",
+ "doctrine/persistence": "^1.3.7|^2.0|^3.0",
+ "php": "^7.1 || ^8.0",
+ "symfony/config": "^3.4|^4.3|^5.0|^6.0",
+ "symfony/console": "^3.4|^4.3|^5.0|^6.0",
+ "symfony/dependency-injection": "^3.4.47|^4.3|^5.0|^6.0",
+ "symfony/doctrine-bridge": "^3.4|^4.1|^5.0|^6.0",
+ "symfony/http-kernel": "^3.4|^4.3|^5.0|^6.0"
+ },
+ "require-dev": {
+ "doctrine/coding-standard": "^9",
+ "phpstan/phpstan": "^1.4.10",
+ "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20",
+ "symfony/phpunit-bridge": "^6.0.8",
+ "vimeo/psalm": "^4.22"
+ },
+ "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.4.2"
+ },
+ "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": "2022-04-28T17:58:29+00:00"
+ },
+ {
+ "name": "fakerphp/faker",
+ "version": "v1.21.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/FakerPHP/Faker.git",
+ "reference": "92efad6a967f0b79c499705c69b662f738cc9e4d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/92efad6a967f0b79c499705c69b662f738cc9e4d",
+ "reference": "92efad6a967f0b79c499705c69b662f738cc9e4d",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.4 || ^8.0",
+ "psr/container": "^1.0 || ^2.0",
+ "symfony/deprecation-contracts": "^2.2 || ^3.0"
+ },
+ "conflict": {
+ "fzaninotto/faker": "*"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.4.1",
+ "doctrine/persistence": "^1.3 || ^2.0",
+ "ext-intl": "*",
+ "phpunit/phpunit": "^9.5.26",
+ "symfony/phpunit-bridge": "^5.4.16"
+ },
+ "suggest": {
+ "doctrine/orm": "Required to use Faker\\ORM\\Doctrine",
+ "ext-curl": "Required by Faker\\Provider\\Image to download images.",
+ "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.",
+ "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.",
+ "ext-mbstring": "Required for multibyte Unicode string functionality."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "v1.21-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Faker\\": "src/Faker/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "François Zaninotto"
+ }
+ ],
+ "description": "Faker is a PHP library that generates fake data for you.",
+ "keywords": [
+ "data",
+ "faker",
+ "fixtures"
+ ],
+ "support": {
+ "issues": "https://github.com/FakerPHP/Faker/issues",
+ "source": "https://github.com/FakerPHP/Faker/tree/v1.21.0"
+ },
+ "time": "2022-12-13T13:54:32+00:00"
+ },
+ {
+ "name": "nikic/php-parser",
+ "version": "v4.15.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/nikic/PHP-Parser.git",
+ "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039",
+ "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=7.0"
+ },
+ "require-dev": {
+ "ircmaxell/php-yacc": "^0.0.7",
+ "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0"
+ },
+ "bin": [
+ "bin/php-parse"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.9-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PhpParser\\": "lib/PhpParser"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Nikita Popov"
+ }
+ ],
+ "description": "A PHP parser written in PHP",
+ "keywords": [
+ "parser",
+ "php"
+ ],
+ "support": {
+ "issues": "https://github.com/nikic/PHP-Parser/issues",
+ "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3"
+ },
+ "time": "2023-01-16T22:05:37+00:00"
+ },
+ {
+ "name": "symfony/maker-bundle",
+ "version": "v1.48.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/maker-bundle.git",
+ "reference": "2e428e8432e9879187672fe08f1cc335e2a31dd6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/2e428e8432e9879187672fe08f1cc335e2a31dd6",
+ "reference": "2e428e8432e9879187672fe08f1cc335e2a31dd6",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/inflector": "^2.0",
+ "nikic/php-parser": "^4.11",
+ "php": ">=8.0",
+ "symfony/config": "^5.4.7|^6.0",
+ "symfony/console": "^5.4.7|^6.0",
+ "symfony/dependency-injection": "^5.4.7|^6.0",
+ "symfony/deprecation-contracts": "^2.2|^3",
+ "symfony/filesystem": "^5.4.7|^6.0",
+ "symfony/finder": "^5.4.3|^6.0",
+ "symfony/framework-bundle": "^5.4.7|^6.0",
+ "symfony/http-kernel": "^5.4.7|^6.0"
+ },
+ "conflict": {
+ "doctrine/doctrine-bundle": "<2.4",
+ "doctrine/orm": "<2.10",
+ "symfony/doctrine-bridge": "<5.4"
+ },
+ "require-dev": {
+ "composer/semver": "^3.0",
+ "doctrine/doctrine-bundle": "^2.4",
+ "doctrine/orm": "^2.10.0",
+ "symfony/http-client": "^5.4.7|^6.0",
+ "symfony/phpunit-bridge": "^5.4.7|^6.0",
+ "symfony/polyfill-php80": "^1.16.0",
+ "symfony/process": "^5.4.7|^6.0",
+ "symfony/security-core": "^5.4.7|^6.0",
+ "symfony/yaml": "^5.4.3|^6.0",
+ "twig/twig": "^2.0|^3.0"
+ },
+ "type": "symfony-bundle",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Bundle\\MakerBundle\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.",
+ "homepage": "https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html",
+ "keywords": [
+ "code generator",
+ "generator",
+ "scaffold",
+ "scaffolding"
+ ],
+ "support": {
+ "issues": "https://github.com/symfony/maker-bundle/issues",
+ "source": "https://github.com/symfony/maker-bundle/tree/v1.48.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-11-14T10:48:46+00:00"
+ }
+ ],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
diff --git a/back/config/bundles.php b/back/config/bundles.php
index ccc600f..002d182 100644
--- a/back/config/bundles.php
+++ b/back/config/bundles.php
@@ -8,4 +8,6 @@ return [
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
+ Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
+ Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
];
diff --git a/back/config/services.yaml b/back/config/services.yaml
index 2d6a76f..306fa60 100644
--- a/back/config/services.yaml
+++ b/back/config/services.yaml
@@ -4,6 +4,7 @@
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
+ images_directory: '%kernel.project_dir%/var/files/images'
services:
# default configuration for services in *this* file
diff --git a/back/migrations/Version20230221150031.php b/back/migrations/Version20230221150031.php
new file mode 100644
index 0000000..2abe3d8
--- /dev/null
+++ b/back/migrations/Version20230221150031.php
@@ -0,0 +1,34 @@
+addSql('CREATE SEQUENCE product_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
+ $this->addSql('CREATE TABLE product (id INT NOT NULL, name VARCHAR(255) NOT NULL, icon_filename TEXT DEFAULT NULL, banner_filename TEXT DEFAULT NULL, description TEXT DEFAULT NULL, PRIMARY KEY(id))');
+ }
+
+ 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 product_id_seq CASCADE');
+ $this->addSql('DROP TABLE product');
+ }
+}
diff --git a/back/src/Controller/ImageController.php b/back/src/Controller/ImageController.php
new file mode 100644
index 0000000..642fcbc
--- /dev/null
+++ b/back/src/Controller/ImageController.php
@@ -0,0 +1,18 @@
+file($this->getParameter('images_directory') . '/' . $filename, null, ResponseHeaderBag::DISPOSITION_INLINE);
+ }
+}
diff --git a/back/src/Controller/ProductController.php b/back/src/Controller/ProductController.php
new file mode 100644
index 0000000..d29aca0
--- /dev/null
+++ b/back/src/Controller/ProductController.php
@@ -0,0 +1,30 @@
+findAll();
+ return $this->json($products);
+ }
+
+ #[Route('/{productId}', name: 'get_product')]
+ public function get_product(ProductRepository $productRepository, int $productId): Response
+ {
+ $product = $productRepository->find($productId);
+ if ($product != null) {
+ return $this->json($product);
+ } else {
+ throw $this->createNotFoundException('This product does not exist');
+ }
+ }
+}
diff --git a/back/src/DataFixtures/AppFixtures.php b/back/src/DataFixtures/AppFixtures.php
new file mode 100644
index 0000000..987f6fe
--- /dev/null
+++ b/back/src/DataFixtures/AppFixtures.php
@@ -0,0 +1,17 @@
+persist($product);
+
+ $manager->flush();
+ }
+}
diff --git a/back/src/DataFixtures/ProductFixtures.php b/back/src/DataFixtures/ProductFixtures.php
new file mode 100644
index 0000000..d879412
--- /dev/null
+++ b/back/src/DataFixtures/ProductFixtures.php
@@ -0,0 +1,45 @@
+faker = Factory::create();
+
+ $icons = [
+ '0893224002970.webp',
+ 'composition_produit_cosmétique.jpg',
+ 'huile-d-argan-cosmetique.jpg',
+ null
+ ];
+
+ $banners = [
+ 'big2-produits-naturels.jpg',
+ 'cremecosmetiqueoriginale800x600_1200x.webp',
+ 'produit-cosmetique-biologique.jpg',
+ null
+ ];
+
+ for ($i = 0; $i < 10; $i++) {
+ $product = new Product();
+ $product->setName($this->faker->word())
+ ->setDescription($this->faker->paragraph())
+ ->setIconFilename($this->faker->randomElement($icons))
+ ->setBannerFilename($this->faker->randomElement($banners));
+ $manager->persist($product);
+ }
+
+ $manager->flush();
+
+ }
+}
diff --git a/back/src/Entity/Product.php b/back/src/Entity/Product.php
new file mode 100644
index 0000000..ffbdff3
--- /dev/null
+++ b/back/src/Entity/Product.php
@@ -0,0 +1,81 @@
+id;
+ }
+
+ public function getName(): ?string
+ {
+ return $this->name;
+ }
+
+ public function setName(string $name): self
+ {
+ $this->name = $name;
+
+ return $this;
+ }
+
+ public function getIconFilename(): ?string
+ {
+ return $this->iconFilename;
+ }
+
+ public function setIconFilename(?string $iconFilename): self
+ {
+ $this->iconFilename = $iconFilename;
+
+ return $this;
+ }
+
+ public function getBannerFilename(): ?string
+ {
+ return $this->bannerFilename;
+ }
+
+ public function setBannerFilename(?string $bannerFilename): self
+ {
+ $this->bannerFilename = $bannerFilename;
+
+ return $this;
+ }
+
+ public function getDescription(): ?string
+ {
+ return $this->description;
+ }
+
+ public function setDescription(?string $description): self
+ {
+ $this->description = $description;
+
+ return $this;
+ }
+}
diff --git a/back/src/Repository/ProductRepository.php b/back/src/Repository/ProductRepository.php
new file mode 100644
index 0000000..9e8c42d
--- /dev/null
+++ b/back/src/Repository/ProductRepository.php
@@ -0,0 +1,66 @@
+
+ *
+ * @method Product|null find($id, $lockMode = null, $lockVersion = null)
+ * @method Product|null findOneBy(array $criteria, array $orderBy = null)
+ * @method Product[] findAll()
+ * @method Product[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
+ */
+class ProductRepository extends ServiceEntityRepository
+{
+ public function __construct(ManagerRegistry $registry)
+ {
+ parent::__construct($registry, Product::class);
+ }
+
+ public function save(Product $entity, bool $flush = false): void
+ {
+ $this->getEntityManager()->persist($entity);
+
+ if ($flush) {
+ $this->getEntityManager()->flush();
+ }
+ }
+
+ public function remove(Product $entity, bool $flush = false): void
+ {
+ $this->getEntityManager()->remove($entity);
+
+ if ($flush) {
+ $this->getEntityManager()->flush();
+ }
+ }
+
+// /**
+// * @return Product[] Returns an array of Product 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): ?Product
+// {
+// return $this->createQueryBuilder('p')
+// ->andWhere('p.exampleField = :val')
+// ->setParameter('val', $value)
+// ->getQuery()
+// ->getOneOrNullResult()
+// ;
+// }
+}
diff --git a/back/symfony.lock b/back/symfony.lock
index 482d315..7e1e00c 100644
--- a/back/symfony.lock
+++ b/back/symfony.lock
@@ -35,6 +35,18 @@
"src/Repository/.gitignore"
]
},
+ "doctrine/doctrine-fixtures-bundle": {
+ "version": "3.4",
+ "recipe": {
+ "repo": "github.com/symfony/recipes",
+ "branch": "main",
+ "version": "3.0",
+ "ref": "1f5514cfa15b947298df4d771e694e578d4c204d"
+ },
+ "files": [
+ "src/DataFixtures/AppFixtures.php"
+ ]
+ },
"doctrine/doctrine-migrations-bundle": {
"version": "3.2",
"recipe": {
@@ -103,6 +115,15 @@
"src/Kernel.php"
]
},
+ "symfony/maker-bundle": {
+ "version": "1.48",
+ "recipe": {
+ "repo": "github.com/symfony/recipes",
+ "branch": "main",
+ "version": "1.0",
+ "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
+ }
+ },
"symfony/routing": {
"version": "6.2",
"recipe": {