diff --git a/back/.idea/dev.iml b/back/.idea/dev.iml index c64f767..c79ca0f 100644 --- a/back/.idea/dev.iml +++ b/back/.idea/dev.iml @@ -86,6 +86,8 @@ + + diff --git a/back/.idea/php.xml b/back/.idea/php.xml index b66ac4c..84f51b0 100644 --- a/back/.idea/php.xml +++ b/back/.idea/php.xml @@ -93,6 +93,8 @@ + + diff --git a/back/composer.json b/back/composer.json index e448103..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.*", diff --git a/back/composer.lock b/back/composer.lock index 939e101..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": "290fb18a445d73c6b44c5ade6839ed9e", + "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", 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/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/DataFixtures/ProductFixtures.php b/back/src/DataFixtures/ProductFixtures.php index 91219d9..d879412 100644 --- a/back/src/DataFixtures/ProductFixtures.php +++ b/back/src/DataFixtures/ProductFixtures.php @@ -16,12 +16,29 @@ class ProductFixtures extends Fixture { $this->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()); + ->setDescription($this->faker->paragraph()) + ->setIconFilename($this->faker->randomElement($icons)) + ->setBannerFilename($this->faker->randomElement($banners)); $manager->persist($product); } + $manager->flush(); }