diff --git a/.env.dist b/.env.dist index 596547a..8096a7d 100644 --- a/.env.dist +++ b/.env.dist @@ -7,4 +7,4 @@ MYSQL_VERSION=8.0.27 MYSQL_DATABASE=databasorus MYSQL_USER=user MYSQL_PASSWORD=password -MAILER_DSN=smtp://mailhog:1025 +MAILER_DSN=smtp://mailhog:1025 \ No newline at end of file diff --git a/assets/images/email/dino.png b/assets/images/email/dino.png deleted file mode 100644 index 9c08b74..0000000 Binary files a/assets/images/email/dino.png and /dev/null differ diff --git a/assets/pdf/cgu.pdf b/assets/pdf/cgu.pdf deleted file mode 100644 index 5c4ce23..0000000 Binary files a/assets/pdf/cgu.pdf and /dev/null differ diff --git a/assets/styles/email/dinosaur_has_been_created.css b/assets/styles/email/dinosaur_has_been_created.css deleted file mode 100644 index ff301b2..0000000 --- a/assets/styles/email/dinosaur_has_been_created.css +++ /dev/null @@ -1,13 +0,0 @@ -#title-wrapper { - display: flex; - align-items: center; - gap: 20px; - background-color: #E24C38; - color: #ffffff; - padding: 30px; - font-weight: normal; -} - -img { - max-height: 100px; -} diff --git a/assets/styles/email/layout.css b/assets/styles/email/layout.css deleted file mode 100644 index bd7f186..0000000 --- a/assets/styles/email/layout.css +++ /dev/null @@ -1,12 +0,0 @@ -body { - margin: 0; - padding: 0; - color: #17325C; - background-color: #f3f3f3; - font-family: Helvetica, Arial, sans-serif; -} - -footer { - text-decoration: italic; - color: grey; -} diff --git a/composer.json b/composer.json index a5d75b5..f760f5c 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,6 @@ "symfony/validator": "^7.0", "symfony/web-link": "^7.0", "symfony/yaml": "^7.0", - "twig/cssinliner-extra": "^3.9", "twig/extra-bundle": "^3.8", "twig/twig": "^3.8" }, diff --git a/composer.lock b/composer.lock index b0a232d..a3c72ad 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": "91438b835a325ba46dda609226153bd0", + "content-hash": "e1d68fda857d3a6a99a9c9d4e0c1c4dd", "packages": [ { "name": "composer/package-versions-deprecated", @@ -2617,71 +2617,6 @@ ], "time": "2024-04-01T11:04:53+00:00" }, - { - "name": "symfony/css-selector", - "version": "v7.0.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "ec60a4edf94e63b0556b6a0888548bb400a3a3be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/ec60a4edf94e63b0556b6a0888548bb400a3a3be", - "reference": "ec60a4edf94e63b0556b6a0888548bb400a3a3be", - "shasum": "" - }, - "require": { - "php": ">=8.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Converts CSS selectors to XPath expressions", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/css-selector/tree/v7.0.3" - }, - "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": "2024-01-23T15:02:46+00:00" - }, { "name": "symfony/dependency-injection", "version": "v7.0.6", @@ -7175,128 +7110,6 @@ ], "time": "2024-01-23T15:02:46+00:00" }, - { - "name": "tijsverkoyen/css-to-inline-styles", - "version": "v2.2.7", - "source": { - "type": "git", - "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/83ee6f38df0a63106a9e4536e3060458b74ccedb", - "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "php": "^5.5 || ^7.0 || ^8.0", - "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "TijsVerkoyen\\CssToInlineStyles\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Tijs Verkoyen", - "email": "css_to_inline_styles@verkoyen.eu", - "role": "Developer" - } - ], - "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", - "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", - "support": { - "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", - "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.2.7" - }, - "time": "2023-12-08T13:03:43+00:00" - }, - { - "name": "twig/cssinliner-extra", - "version": "v3.9.0", - "source": { - "type": "git", - "url": "https://github.com/twigphp/cssinliner-extra.git", - "reference": "419e3e98431da91e8051ffdb447725d10935285d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twigphp/cssinliner-extra/zipball/419e3e98431da91e8051ffdb447725d10935285d", - "reference": "419e3e98431da91e8051ffdb447725d10935285d", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.5|^3", - "tijsverkoyen/css-to-inline-styles": "^2.0", - "twig/twig": "^3.0" - }, - "require-dev": { - "symfony/phpunit-bridge": "^6.4|^7.0" - }, - "type": "library", - "autoload": { - "files": [ - "Resources/functions.php" - ], - "psr-4": { - "Twig\\Extra\\CssInliner\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - } - ], - "description": "A Twig extension to allow inlining CSS", - "homepage": "https://twig.symfony.com", - "keywords": [ - "css", - "inlining", - "twig" - ], - "support": { - "source": "https://github.com/twigphp/cssinliner-extra/tree/v3.9.0" - }, - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/twig/twig", - "type": "tidelift" - } - ], - "time": "2023-12-10T19:34:32+00:00" - }, { "name": "twig/extra-bundle", "version": "v3.8.0", @@ -9429,6 +9242,71 @@ ], "time": "2024-01-23T15:02:46+00:00" }, + { + "name": "symfony/css-selector", + "version": "v7.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "ec60a4edf94e63b0556b6a0888548bb400a3a3be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/ec60a4edf94e63b0556b6a0888548bb400a3a3be", + "reference": "ec60a4edf94e63b0556b6a0888548bb400a3a3be", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Converts CSS selectors to XPath expressions", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/css-selector/tree/v7.0.3" + }, + "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": "2024-01-23T15:02:46+00:00" + }, { "name": "symfony/debug-bundle", "version": "v7.0.3", diff --git a/config/packages/mailer.yaml b/config/packages/mailer.yaml index 8762795..56a650d 100644 --- a/config/packages/mailer.yaml +++ b/config/packages/mailer.yaml @@ -1,7 +1,3 @@ framework: mailer: dsn: '%env(MAILER_DSN)%' - envelope: - sender: 'jurrasic.park@mail.com' - headers: - From: 'Jurassic Park ' diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index f8770a5..976c627 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -1,9 +1,6 @@ twig: default_path: '%kernel.project_dir%/templates' - paths: - '%kernel.project_dir%/assets/images': images - '%kernel.project_dir%/assets/styles': styles - form_themes: + form_themes: - 'bootstrap_5_layout.html.twig' - 'form/bootstrap_5_layout.html.twig' diff --git a/config/services.yaml b/config/services.yaml index 62b5c1e..1d3246d 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -8,7 +8,6 @@ parameters: env(MYSQL_DATABASE): '%env(resolve:MYSQL_DATABASE)%' env(MYSQL_USER): '%env(resolve:MYSQL_USER)%' env(MYSQL_PASSWORD): '%env(resolve:MYSQL_PASSWORD)%' - app.pdf_directory: '%kernel.project_dir%/assets/pdf' services: # default configuration for services in *this* file diff --git a/docker-compose.yml b/docker-compose.yml index 7dd0301..6f9f8ba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,11 +42,5 @@ services: - db-data:/var/lib/mysql:rw restart: unless-stopped - mailhog: - image: mailhog/mailhog - restart: on-failure - ports: - - 127.0.0.1:8025:8025 - volumes: db-data: ~ diff --git a/src/Controller/DinosaursController.php b/src/Controller/DinosaursController.php index 9847122..4ced07c 100644 --- a/src/Controller/DinosaursController.php +++ b/src/Controller/DinosaursController.php @@ -3,16 +3,13 @@ namespace App\Controller; use App\Entity\Dinosaur; -use App\Entity\User; use App\Form\Type\DinosaurType; use App\Form\Type\SearchType; -use App\Service\Mailer; use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Http\Attribute\CurrentUser; final class DinosaursController extends AbstractController { @@ -61,12 +58,8 @@ public function single(string $id, ManagerRegistry $doctrine): Response } #[Route('/dinosaurs/create', name: 'app_create_dinosaur')] - public function create( - Request $request, - ManagerRegistry $doctrine, - #[CurrentUser] User $user, - Mailer $mailer - ): Response { + public function create(Request $request, ManagerRegistry $doctrine): Response + { $form = $this->createForm(DinosaurType::class); $form->handleRequest($request); @@ -80,8 +73,6 @@ public function create( $this->addFlash('success', 'The dinosaur has been created!'); - $mailer->sendDinausorHasBeenCreatedEmail($dinosaur, $user); - return $this->redirectToRoute('app_list_dinosaurs'); } diff --git a/src/Service/Mailer.php b/src/Service/Mailer.php deleted file mode 100644 index 7706fbd..0000000 --- a/src/Service/Mailer.php +++ /dev/null @@ -1,43 +0,0 @@ -subject('Your dinosaur has been created !') - ->to($user->getUserIdentifier()) - ->htmlTemplate('emails/dinosaur_has_been_created.html.twig') - ->context(['dinosaur' => $dinosaur]) - ->attachFromPath( - $this->pdfDirectory . '/cgu.pdf', - 'CGU.pdf', - 'application/pdf' - ); - - $this->send($email); - } - - private function send(Email $email): void - { - $this->mailer->send($email); - } -} diff --git a/templates/emails/dinosaur_has_been_created.html.twig b/templates/emails/dinosaur_has_been_created.html.twig deleted file mode 100644 index fd44f87..0000000 --- a/templates/emails/dinosaur_has_been_created.html.twig +++ /dev/null @@ -1,13 +0,0 @@ -{% extends 'emails/layout.html.twig' %} - -{% block messageBody %} -{% apply inline_css(source('@styles/email/dinosaur_has_been_created.css')) %} - -
- Dino Park -

Congratulations ! {{ dinosaur.name }} has been created !

-
-

It is now part of your collection !

- -{% endapply %} -{% endblock %} diff --git a/templates/emails/layout.html.twig b/templates/emails/layout.html.twig deleted file mode 100644 index f1651fa..0000000 --- a/templates/emails/layout.html.twig +++ /dev/null @@ -1,18 +0,0 @@ -{% apply inline_css(source('@styles/email/layout.css')) %} - - - - - {{ email.subject }} - - - {% block messageBody %}{% endblock %} - - - -{% endapply %}