From 8b2341251daee394a914fecb896a563703edbb36 Mon Sep 17 00:00:00 2001 From: Jelmer Ketelaar Date: Sat, 30 Oct 2021 11:01:10 +0200 Subject: [PATCH 01/35] Added some styling to the page --- composer.json | 2 +- composer.lock | 242 +++++++++--------- public/style/style.css | 23 +- src/Controller/MealController.php | 9 +- src/Entity/MealMatcher.php | 61 ----- src/Service/MealMatcherService.php | 51 ++-- templates/base.html.twig | 6 +- templates/categories/index.html.twig | 29 ++- .../{landing page => landing}/index.html.twig | 17 +- templates/meals/index.html.twig | 3 +- templates/wines/index.html.twig | 137 +++++----- 11 files changed, 258 insertions(+), 322 deletions(-) delete mode 100644 src/Entity/MealMatcher.php rename templates/{landing page => landing}/index.html.twig (80%) diff --git a/composer.json b/composer.json index 23a8f46..4e8c700 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,8 @@ "doctrine/doctrine-migrations-bundle": "^3.1", "doctrine/orm": "^2.10", "doctrine/sql-formatter": "^1.1", - "guzzlehttp/guzzle": "^6.5", "grandcruwijnen/sdk": "^0.1.26", + "guzzlehttp/guzzle": "^6.5", "nelmio/cors-bundle": "^2.1", "phpdocumentor/reflection-docblock": "^5.2", "sensio/framework-extra-bundle": "^6.1", diff --git a/composer.lock b/composer.lock index 3405319..17e0e28 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": "d3508be1f7135909222903d386818055", + "content-hash": "537336eeb8478c40d7cc2815a8618776", "packages": [ { "name": "api-platform/core", @@ -3021,16 +3021,16 @@ }, { "name": "symfony/cache", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "945bcebfef0aeef105de61843dd14105633ae38f" + "reference": "2056f2123f47c9f63102a8b92974c362f4fba568" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/945bcebfef0aeef105de61843dd14105633ae38f", - "reference": "945bcebfef0aeef105de61843dd14105633ae38f", + "url": "https://api.github.com/repos/symfony/cache/zipball/2056f2123f47c9f63102a8b92974c362f4fba568", + "reference": "2056f2123f47c9f63102a8b92974c362f4fba568", "shasum": "" }, "require": { @@ -3098,7 +3098,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.3.8" + "source": "https://github.com/symfony/cache/tree/v5.3.10" }, "funding": [ { @@ -3114,7 +3114,7 @@ "type": "tidelift" } ], - "time": "2021-09-26T18:29:18+00:00" + "time": "2021-10-11T15:41:55+00:00" }, { "name": "symfony/cache-contracts", @@ -3197,16 +3197,16 @@ }, { "name": "symfony/config", - "version": "v5.3.4", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "4268f3059c904c61636275182707f81645517a37" + "reference": "ac23c2f24d5634966d665d836c3933d54347e5d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/4268f3059c904c61636275182707f81645517a37", - "reference": "4268f3059c904c61636275182707f81645517a37", + "url": "https://api.github.com/repos/symfony/config/zipball/ac23c2f24d5634966d665d836c3933d54347e5d4", + "reference": "ac23c2f24d5634966d665d836c3933d54347e5d4", "shasum": "" }, "require": { @@ -3256,7 +3256,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v5.3.4" + "source": "https://github.com/symfony/config/tree/v5.3.10" }, "funding": [ { @@ -3272,20 +3272,20 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2021-10-22T09:06:52+00:00" }, { "name": "symfony/console", - "version": "v5.3.7", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" + "reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", + "url": "https://api.github.com/repos/symfony/console/zipball/d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3", + "reference": "d4e409d9fbcfbf71af0e5a940abb7b0b4bad0bd3", "shasum": "" }, "require": { @@ -3355,7 +3355,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.7" + "source": "https://github.com/symfony/console/tree/v5.3.10" }, "funding": [ { @@ -3371,20 +3371,20 @@ "type": "tidelift" } ], - "time": "2021-08-25T20:02:16+00:00" + "time": "2021-10-26T09:30:15+00:00" }, { "name": "symfony/dependency-injection", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "e39c344e06a3ceab531ebeb6c077e6652c4a0829" + "reference": "be833dd336c248ef2bdabf24665351455f52afdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e39c344e06a3ceab531ebeb6c077e6652c4a0829", - "reference": "e39c344e06a3ceab531ebeb6c077e6652c4a0829", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/be833dd336c248ef2bdabf24665351455f52afdb", + "reference": "be833dd336c248ef2bdabf24665351455f52afdb", "shasum": "" }, "require": { @@ -3443,7 +3443,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v5.3.8" + "source": "https://github.com/symfony/dependency-injection/tree/v5.3.10" }, "funding": [ { @@ -3459,7 +3459,7 @@ "type": "tidelift" } ], - "time": "2021-09-21T20:52:44+00:00" + "time": "2021-10-22T18:11:05+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3644,16 +3644,16 @@ }, { "name": "symfony/dotenv", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "12888c9c46ac750ec5c1381db5bf3d534e7d70cb" + "reference": "97ffd3846f8a782086e82c1b5fdefb3f3ad078db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/12888c9c46ac750ec5c1381db5bf3d534e7d70cb", - "reference": "12888c9c46ac750ec5c1381db5bf3d534e7d70cb", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/97ffd3846f8a782086e82c1b5fdefb3f3ad078db", + "reference": "97ffd3846f8a782086e82c1b5fdefb3f3ad078db", "shasum": "" }, "require": { @@ -3694,7 +3694,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v5.3.8" + "source": "https://github.com/symfony/dotenv/tree/v5.3.10" }, "funding": [ { @@ -3710,7 +3710,7 @@ "type": "tidelift" } ], - "time": "2021-07-29T06:18:06+00:00" + "time": "2021-10-28T21:34:29+00:00" }, { "name": "symfony/error-handler", @@ -4202,16 +4202,16 @@ }, { "name": "symfony/form", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/form.git", - "reference": "417bb0355ed1027817c14f39aff353e9fb4bd9a8" + "reference": "656a1e370b1a617ba2fd42700b5e73dc24e8b60c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/form/zipball/417bb0355ed1027817c14f39aff353e9fb4bd9a8", - "reference": "417bb0355ed1027817c14f39aff353e9fb4bd9a8", + "url": "https://api.github.com/repos/symfony/form/zipball/656a1e370b1a617ba2fd42700b5e73dc24e8b60c", + "reference": "656a1e370b1a617ba2fd42700b5e73dc24e8b60c", "shasum": "" }, "require": { @@ -4284,7 +4284,7 @@ "description": "Allows to easily create, process and reuse HTML forms", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/form/tree/v5.3.8" + "source": "https://github.com/symfony/form/tree/v5.3.10" }, "funding": [ { @@ -4300,20 +4300,20 @@ "type": "tidelift" } ], - "time": "2021-09-21T20:52:44+00:00" + "time": "2021-10-28T19:22:18+00:00" }, { "name": "symfony/framework-bundle", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "ea6e30a8c9534d87187375ef4ee39d48ee40dd2d" + "reference": "2ff74f86abf2f67f2d0b53e23ab7a268b105dcfe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/ea6e30a8c9534d87187375ef4ee39d48ee40dd2d", - "reference": "ea6e30a8c9534d87187375ef4ee39d48ee40dd2d", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/2ff74f86abf2f67f2d0b53e23ab7a268b105dcfe", + "reference": "2ff74f86abf2f67f2d0b53e23ab7a268b105dcfe", "shasum": "" }, "require": { @@ -4435,7 +4435,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v5.3.8" + "source": "https://github.com/symfony/framework-bundle/tree/v5.3.10" }, "funding": [ { @@ -4451,20 +4451,20 @@ "type": "tidelift" } ], - "time": "2021-09-28T07:17:01+00:00" + "time": "2021-10-26T11:54:54+00:00" }, { "name": "symfony/http-client", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "c6370fe2c0a445aedc08f592a6a3149da1fea4c7" + "reference": "710b69ed4bc9469900ec5ae5c3807b0509bee0dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/c6370fe2c0a445aedc08f592a6a3149da1fea4c7", - "reference": "c6370fe2c0a445aedc08f592a6a3149da1fea4c7", + "url": "https://api.github.com/repos/symfony/http-client/zipball/710b69ed4bc9469900ec5ae5c3807b0509bee0dc", + "reference": "710b69ed4bc9469900ec5ae5c3807b0509bee0dc", "shasum": "" }, "require": { @@ -4522,7 +4522,7 @@ "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-client/tree/v5.3.8" + "source": "https://github.com/symfony/http-client/tree/v5.3.10" }, "funding": [ { @@ -4538,7 +4538,7 @@ "type": "tidelift" } ], - "time": "2021-09-07T10:45:28+00:00" + "time": "2021-10-19T08:32:53+00:00" }, { "name": "symfony/http-client-contracts", @@ -4620,16 +4620,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.3.7", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5" + "reference": "9f34f02e8a5fdc7a56bafe011cea1ce97300e54c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", - "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/9f34f02e8a5fdc7a56bafe011cea1ce97300e54c", + "reference": "9f34f02e8a5fdc7a56bafe011cea1ce97300e54c", "shasum": "" }, "require": { @@ -4673,7 +4673,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.3.7" + "source": "https://github.com/symfony/http-foundation/tree/v5.3.10" }, "funding": [ { @@ -4689,20 +4689,20 @@ "type": "tidelift" } ], - "time": "2021-08-27T11:20:35+00:00" + "time": "2021-10-11T15:41:55+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.3.9", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "ceaf46a992f60e90645e7279825a830f733a17c5" + "reference": "703e4079920468e9522b72cf47fd76ce8d795e86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ceaf46a992f60e90645e7279825a830f733a17c5", - "reference": "ceaf46a992f60e90645e7279825a830f733a17c5", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/703e4079920468e9522b72cf47fd76ce8d795e86", + "reference": "703e4079920468e9522b72cf47fd76ce8d795e86", "shasum": "" }, "require": { @@ -4785,7 +4785,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.3.9" + "source": "https://github.com/symfony/http-kernel/tree/v5.3.10" }, "funding": [ { @@ -4801,7 +4801,7 @@ "type": "tidelift" } ], - "time": "2021-09-28T10:25:11+00:00" + "time": "2021-10-29T08:36:48+00:00" }, { "name": "symfony/intl", @@ -6503,16 +6503,16 @@ }, { "name": "symfony/runtime", - "version": "v5.3.4", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/runtime.git", - "reference": "685a4a5491e25c7f2dd251d8fcca583b427ff290" + "reference": "115eebbe287b35d65bd7b062bf3362e135941a59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/runtime/zipball/685a4a5491e25c7f2dd251d8fcca583b427ff290", - "reference": "685a4a5491e25c7f2dd251d8fcca583b427ff290", + "url": "https://api.github.com/repos/symfony/runtime/zipball/115eebbe287b35d65bd7b062bf3362e135941a59", + "reference": "115eebbe287b35d65bd7b062bf3362e135941a59", "shasum": "" }, "require": { @@ -6560,7 +6560,7 @@ "description": "Enables decoupling PHP applications from global state", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/runtime/tree/v5.3.4" + "source": "https://github.com/symfony/runtime/tree/v5.3.10" }, "funding": [ { @@ -6576,7 +6576,7 @@ "type": "tidelift" } ], - "time": "2021-06-30T13:49:12+00:00" + "time": "2021-10-22T08:45:15+00:00" }, { "name": "symfony/security-bundle", @@ -6682,16 +6682,16 @@ }, { "name": "symfony/security-core", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "62e5943d042aa5fc43d44b40209aa7304f68c56e" + "reference": "eb0421ce78603ba72e1de6eeeb8dd33e832ea605" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/62e5943d042aa5fc43d44b40209aa7304f68c56e", - "reference": "62e5943d042aa5fc43d44b40209aa7304f68c56e", + "url": "https://api.github.com/repos/symfony/security-core/zipball/eb0421ce78603ba72e1de6eeeb8dd33e832ea605", + "reference": "eb0421ce78603ba72e1de6eeeb8dd33e832ea605", "shasum": "" }, "require": { @@ -6755,7 +6755,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v5.3.8" + "source": "https://github.com/symfony/security-core/tree/v5.3.10" }, "funding": [ { @@ -6771,7 +6771,7 @@ "type": "tidelift" } ], - "time": "2021-09-21T20:52:44+00:00" + "time": "2021-10-25T13:34:14+00:00" }, { "name": "symfony/security-csrf", @@ -6914,16 +6914,16 @@ }, { "name": "symfony/security-http", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "d499ecde6f81de42e557514626d6d5c14c0bdb78" + "reference": "613ca73c22d8228986ff95f7769182db4f4bb7dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/d499ecde6f81de42e557514626d6d5c14c0bdb78", - "reference": "d499ecde6f81de42e557514626d6d5c14c0bdb78", + "url": "https://api.github.com/repos/symfony/security-http/zipball/613ca73c22d8228986ff95f7769182db4f4bb7dc", + "reference": "613ca73c22d8228986ff95f7769182db4f4bb7dc", "shasum": "" }, "require": { @@ -6979,7 +6979,7 @@ "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-http/tree/v5.3.8" + "source": "https://github.com/symfony/security-http/tree/v5.3.10" }, "funding": [ { @@ -6995,20 +6995,20 @@ "type": "tidelift" } ], - "time": "2021-09-26T16:35:00+00:00" + "time": "2021-10-26T07:06:56+00:00" }, { "name": "symfony/serializer", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "a877799b1e94f792208bea68295f6675027c92be" + "reference": "5d7f068253ac3e7c62964ebdda491b06d401059a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/a877799b1e94f792208bea68295f6675027c92be", - "reference": "a877799b1e94f792208bea68295f6675027c92be", + "url": "https://api.github.com/repos/symfony/serializer/zipball/5d7f068253ac3e7c62964ebdda491b06d401059a", + "reference": "5d7f068253ac3e7c62964ebdda491b06d401059a", "shasum": "" }, "require": { @@ -7081,7 +7081,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v5.3.8" + "source": "https://github.com/symfony/serializer/tree/v5.3.10" }, "funding": [ { @@ -7097,7 +7097,7 @@ "type": "tidelift" } ], - "time": "2021-09-17T08:55:39+00:00" + "time": "2021-09-29T17:19:25+00:00" }, { "name": "symfony/service-contracts", @@ -7242,16 +7242,16 @@ }, { "name": "symfony/string", - "version": "v5.3.7", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" + "reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", + "url": "https://api.github.com/repos/symfony/string/zipball/d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c", + "reference": "d70c35bb20bbca71fc4ab7921e3c6bda1a82a60c", "shasum": "" }, "require": { @@ -7305,7 +7305,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.7" + "source": "https://github.com/symfony/string/tree/v5.3.10" }, "funding": [ { @@ -7321,20 +7321,20 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:00:08+00:00" + "time": "2021-10-27T18:21:46+00:00" }, { "name": "symfony/translation", - "version": "v5.3.9", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "6e69f3551c1a3356cf6ea8d019bf039a0f8b6886" + "reference": "6ef197aea2ac8b9cd63e0da7522b3771714035aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/6e69f3551c1a3356cf6ea8d019bf039a0f8b6886", - "reference": "6e69f3551c1a3356cf6ea8d019bf039a0f8b6886", + "url": "https://api.github.com/repos/symfony/translation/zipball/6ef197aea2ac8b9cd63e0da7522b3771714035aa", + "reference": "6ef197aea2ac8b9cd63e0da7522b3771714035aa", "shasum": "" }, "require": { @@ -7400,7 +7400,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.3.9" + "source": "https://github.com/symfony/translation/tree/v5.3.10" }, "funding": [ { @@ -7416,7 +7416,7 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:22:53+00:00" + "time": "2021-10-10T06:43:24+00:00" }, { "name": "symfony/translation-contracts", @@ -7619,16 +7619,16 @@ }, { "name": "symfony/twig-bundle", - "version": "v5.3.4", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/twig-bundle.git", - "reference": "345965b40c1847ebdbb2ab0eb98c71a98a5e167b" + "reference": "70157db4357eadf33f38e4e7efa5da4b294e17de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/345965b40c1847ebdbb2ab0eb98c71a98a5e167b", - "reference": "345965b40c1847ebdbb2ab0eb98c71a98a5e167b", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/70157db4357eadf33f38e4e7efa5da4b294e17de", + "reference": "70157db4357eadf33f38e4e7efa5da4b294e17de", "shasum": "" }, "require": { @@ -7687,7 +7687,7 @@ "description": "Provides a tight integration of Twig into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bundle/tree/v5.3.4" + "source": "https://github.com/symfony/twig-bundle/tree/v5.3.10" }, "funding": [ { @@ -7703,20 +7703,20 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2021-10-28T13:28:41+00:00" }, { "name": "symfony/validator", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "3a773f6f03ef2846c280e4f5b5f34cf950ead127" + "reference": "a85f3ba9e1c883253fc00a2e3d111e6e82a0baf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/3a773f6f03ef2846c280e4f5b5f34cf950ead127", - "reference": "3a773f6f03ef2846c280e4f5b5f34cf950ead127", + "url": "https://api.github.com/repos/symfony/validator/zipball/a85f3ba9e1c883253fc00a2e3d111e6e82a0baf5", + "reference": "a85f3ba9e1c883253fc00a2e3d111e6e82a0baf5", "shasum": "" }, "require": { @@ -7797,7 +7797,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v5.3.8" + "source": "https://github.com/symfony/validator/tree/v5.3.10" }, "funding": [ { @@ -7813,20 +7813,20 @@ "type": "tidelift" } ], - "time": "2021-09-21T20:52:44+00:00" + "time": "2021-10-28T19:22:18+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da" + "reference": "875432adb5f5570fff21036fd22aee244636b7d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/eaaea4098be1c90c8285543e1356a09c8aa5c8da", - "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/875432adb5f5570fff21036fd22aee244636b7d1", + "reference": "875432adb5f5570fff21036fd22aee244636b7d1", "shasum": "" }, "require": { @@ -7885,7 +7885,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.3.8" + "source": "https://github.com/symfony/var-dumper/tree/v5.3.10" }, "funding": [ { @@ -7901,7 +7901,7 @@ "type": "tidelift" } ], - "time": "2021-09-24T15:59:58+00:00" + "time": "2021-10-26T09:30:15+00:00" }, { "name": "symfony/var-exporter", @@ -10873,16 +10873,16 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v5.3.8", + "version": "v5.3.10", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "e9c0548d8d7abcd257f18f0adc0517895996a9c1" + "reference": "325aaf6302501ed3673cffbd3ba88db5949de8ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/e9c0548d8d7abcd257f18f0adc0517895996a9c1", - "reference": "e9c0548d8d7abcd257f18f0adc0517895996a9c1", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/325aaf6302501ed3673cffbd3ba88db5949de8ae", + "reference": "325aaf6302501ed3673cffbd3ba88db5949de8ae", "shasum": "" }, "require": { @@ -10936,7 +10936,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v5.3.8" + "source": "https://github.com/symfony/phpunit-bridge/tree/v5.3.10" }, "funding": [ { @@ -10952,7 +10952,7 @@ "type": "tidelift" } ], - "time": "2021-09-14T13:57:08+00:00" + "time": "2021-10-28T19:22:18+00:00" }, { "name": "symfony/web-profiler-bundle", diff --git a/public/style/style.css b/public/style/style.css index 229eb4a..da2a984 100644 --- a/public/style/style.css +++ b/public/style/style.css @@ -5,6 +5,18 @@ body { background-color: #e9dcd1; } +.example-wrapper { + margin: 1em auto; + max-width: 800px; + width: 95%; + font: 18px/1.5 sans-serif; +} + +.example-wrapper code { + background: #F5F5F5; + padding: 2px 6px; +} + .p { line-height: 1.5; } @@ -40,10 +52,15 @@ body { .text { margin-left: 2vw; } + h1 { font-size: 4rem; } -.container { - margin-top: 5000000vh !important; -} \ No newline at end of file +.logo_landing_page { + margin: 30px 30px 30px 5vw; +} + +.logo { + margin: 30px 30px 30px -15vw; +} diff --git a/src/Controller/MealController.php b/src/Controller/MealController.php index c98400c..f60a5b1 100644 --- a/src/Controller/MealController.php +++ b/src/Controller/MealController.php @@ -15,10 +15,13 @@ class MealController extends AbstractController { + /** + * @throws GuzzleException + */ #[Route('/', name: 'landing_page')] public function getIndex(MealMatcherService $mealMatcherService): Response { - return $this->render('landing page/index.html.twig', ['choices' => $mealMatcherService->getIndexPage()]); + return $this->render('landing/index.html.twig', ['choices' => $mealMatcherService->getIndexPage()]); } /** @@ -33,7 +36,7 @@ public function getMealCategories(MealMatcherService $mealMatcherService): Respo /** * @throws GuzzleException */ - #[Route('/{parentId}', name: 'meal_categories_for_parent')] + #[Route('/category/{parentId}', name: 'meal_categories_for_parent')] public function getCategoriesForParent(int $parentId, MealMatcherService $mealMatcherService): Response { return $this->render('categories/index.html.twig', ['meals' => $mealMatcherService->getCategoriesForParent($parentId)]); @@ -52,7 +55,7 @@ public function getMealsForCategory(int $categoryId, MealMatcherService $mealMat * @throws GuzzleException */ #[Route('/matches/{mealId}', name: 'wines_for_meals')] - public function getWinesForMeals($mealId, MealMatcherService $mealMatcherService) + public function getWinesForMeals($mealId, MealMatcherService $mealMatcherService): Response { $api = new API("jelmer@grandcruwijnen.nl", "7Wn2okY7!A@mX-DZMmw7tanFaQ*sTGef87o!Gn4_mE6ctiqmLk2hH6LX_deN_K8P7U6LRs7H2BT.cGWvh", "https://beta.grandcruwijnen.dev"); diff --git a/src/Entity/MealMatcher.php b/src/Entity/MealMatcher.php deleted file mode 100644 index 6dd8bd8..0000000 --- a/src/Entity/MealMatcher.php +++ /dev/null @@ -1,61 +0,0 @@ -id; - } - - public function getName(): ?string - { - return $this->name; - } - - public function setName(string $name): self - { - $this->name = $name; - - return $this; - } - - public function getImage(): ?string - { - return $this->image; - } - - public function setImage(string $image): self - { - $this->image = $image; - - return $this; - } -} diff --git a/src/Service/MealMatcherService.php b/src/Service/MealMatcherService.php index 255ab83..cf2d4e0 100644 --- a/src/Service/MealMatcherService.php +++ b/src/Service/MealMatcherService.php @@ -3,12 +3,11 @@ namespace App\Service; -use Grandcruwijnen\SDK\Products; use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; -use App\Controller\MealController; -class MealMatcherService { +class MealMatcherService +{ private Client $client; public function __construct() @@ -16,46 +15,44 @@ public function __construct() $this->client = new Client(['base_uri' => 'https://mealmatcher.grandcruwijnen.nl']); } - /** + /** * @throws \GuzzleHttp\Exception\GuzzleException */ public function getIndexPage() { - return 'landing page/index.html.twig'; + return 'landing/index.html.twig'; } /** * @throws GuzzleException */ - public function getMealsCategories() + public function getParentMealCategories(): array { - $response = $this->client->request('GET', '/api/meal_categories'); + $categories = $this->getMealsCategories(); + $parentCategories = []; - $categories = json_decode($response->getBody()->getContents()); - usort($categories, function ($categoryA, $categoryB) { - return strcmp($categoryA->name, $categoryB->name); - }); + foreach ($categories as $category) { + if ($category->parent === null) { + $parentCategories[] = $category; + } + } - return $categories; + return $parentCategories; } /** * @throws GuzzleException */ - public function getParentMealCategories(): array + public function getMealsCategories() { - $categories = $this->getMealsCategories(); - $parentCategories = []; + $response = $this->client->request('GET', '/api/meal_categories'); - foreach ($categories as $category) - { - if ($category->parent === null) - { - $parentCategories[] = $category; - } - } + $categories = json_decode($response->getBody()->getContents()); + usort($categories, function ($categoryA, $categoryB) { + return strcmp($categoryA->name, $categoryB->name); + }); - return $parentCategories; + return $categories; } /** @@ -66,10 +63,8 @@ public function getCategoriesForParent(int $parentId): array $categories = $this->getMealsCategories(); $childCategories = []; - foreach ($categories as $category) - { - if ($category->parent !== null && $category->parent->categoryId === $parentId) - { + foreach ($categories as $category) { + if ($category->parent !== null && $category->parent->categoryId === $parentId) { $childCategories[] = $category; } } @@ -91,7 +86,7 @@ public function getMealsForCategory(int $categoryId) */ public function getWinesForMeal($mealId) { - $response = $this->client->request('GET', '/api/meal_matches?mealId=' . $mealId . '&limit=30', ); + $response = $this->client->request('GET', '/api/meal_matches?mealId=' . $mealId . '&limit=30',); return json_decode($response->getBody()->getContents()); } } \ No newline at end of file diff --git a/templates/base.html.twig b/templates/base.html.twig index 5f11ae7..a55fcf1 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -17,7 +17,7 @@ {% endblock %} - - {% block body %}{% endblock %} - + {% block body %} + + {% endblock %} \ No newline at end of file diff --git a/templates/categories/index.html.twig b/templates/categories/index.html.twig index c8987aa..1b1acf7 100644 --- a/templates/categories/index.html.twig +++ b/templates/categories/index.html.twig @@ -10,27 +10,30 @@ {% block body %} -
-
- - logo - -
-

U het gerecht en wij adviseren de wijn!

-

-
+
+
+ + + +
+

U het gerecht en wij adviseren de wijn!

+

+

{% set imageCategory = ['https://www.grandcruwijnen.nl/static/version1634749600/frontend/Grandcruwijnen/default/nl_NL/Grandcruwijnen_SmartSommelier/images/93.svg','https://www.grandcruwijnen.nl/static/version1634749600/frontend/Grandcruwijnen/default/nl_NL/Grandcruwijnen_SmartSommelier/images/52.svg','https://www.grandcruwijnen.nl/static/version1634749600/frontend/Grandcruwijnen/default/nl_NL/Grandcruwijnen_SmartSommelier/images/78.svg','https://www.grandcruwijnen.nl/static/version1634749600/frontend/Grandcruwijnen/default/nl_NL/Grandcruwijnen_SmartSommelier/images/2.svg','https://www.grandcruwijnen.nl/static/version1634749600/frontend/Grandcruwijnen/default/nl_NL/Grandcruwijnen_SmartSommelier/images/139.svg','https://www.grandcruwijnen.nl/static/version1634749600/frontend/Grandcruwijnen/default/nl_NL/Grandcruwijnen_SmartSommelier/images/24.svg','https://www.grandcruwijnen.nl/static/version1634749600/frontend/Grandcruwijnen/default/nl_NL/Grandcruwijnen_SmartSommelier/images/109.svg','https://www.grandcruwijnen.nl/static/version1634749600/frontend/Grandcruwijnen/default/nl_NL/Grandcruwijnen_SmartSommelier/images/102.svg'] %} {% set imageCounterArr = -1 %} {% for meal in meals %} - {% set imageCounterArr = imageCounterArr + 1 %} + {% set imageCounterArr = imageCounterArr + 1 %}
{% if meal.parent is null %}
{{ meal.name }}
+ alt="" class="image">
{% else %} @@ -44,9 +47,9 @@
{% endblock %} -{% block javascripts%} +{% block javascripts %} diff --git a/templates/landing page/index.html.twig b/templates/landing/index.html.twig similarity index 80% rename from templates/landing page/index.html.twig rename to templates/landing/index.html.twig index 127fe1c..89dfb9c 100644 --- a/templates/landing page/index.html.twig +++ b/templates/landing/index.html.twig @@ -3,25 +3,12 @@ {% endblock %} -{% block title %}Hello MealController!{% endblock %} +{% block title %}Landing Page!{% endblock %} {% block body %} -
logo + alt='logo' class="logo_landing_page">

Grandcruwijnen biedt u de volgende opties:

diff --git a/templates/meals/index.html.twig b/templates/meals/index.html.twig index 5c22ece..a93ebad 100644 --- a/templates/meals/index.html.twig +++ b/templates/meals/index.html.twig @@ -17,7 +17,8 @@ } {# https://mealmatcher.grandcruwijnen.nl/meals/%7B12de8bb3-8ce2-43a9-8b09-d56161365ebc%7D #} - logo + logo

Welkom bij de online sommelier

diff --git a/templates/wines/index.html.twig b/templates/wines/index.html.twig index 1588236..fa8a9fb 100644 --- a/templates/wines/index.html.twig +++ b/templates/wines/index.html.twig @@ -1,95 +1,86 @@ {% extends 'base.html.twig' %} {% block stylesheets %} - - + + {% endblock %} {% block title %} -Hello MealController! + The wine matches {% endblock %} {% block body %} - - -
- logo - -
+
+

Welkom bij de online sommelier

+

Hier kunt u kiezen uit de best bijpassende wijnen gezocht bij het geselecteerde gerecht.

+
-
-

Welkom bij de online sommelier

-

Hier kunt u kiezen uit de best bijpassende wijnen gezocht bij het geselecteerde gerecht.

-
+
+
+
+ +

{{ products.name }}

+

€ {{ products.price }}

+ + + -
-
- {% for product in products %} -
- -

{{products.name}}

- - - + + + +{% endblock %} - {% block javascripts%} - + {% block javascripts %} + - - + + - {% endblock %} \ No newline at end of file + {% endblock %} From 85ea0a02766f3c02ddf00912d178a10fceef29e9 Mon Sep 17 00:00:00 2001 From: Jelmer Ketelaar Date: Sat, 30 Oct 2021 11:03:46 +0200 Subject: [PATCH 02/35] Added min-height to meal image --- templates/meals/index.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/meals/index.html.twig b/templates/meals/index.html.twig index a93ebad..67d2420 100644 --- a/templates/meals/index.html.twig +++ b/templates/meals/index.html.twig @@ -29,7 +29,7 @@
{% for meal in meals %}
- {{ meal.name }} + {{ meal.name }}

{{ meal.name }}

From 5aef9c212fd6784625675cc833dea7e1d0aeee3e Mon Sep 17 00:00:00 2001 From: Jelmer Date: Sun, 31 Oct 2021 17:02:32 +0100 Subject: [PATCH 03/35] Created a Product entity --- src/Controller/MealController.php | 2 +- src/Entity/{MealMatcher.php => Product.php} | 30 +++++++++---- src/Repository/ProductRepository.php | 50 +++++++++++++++++++++ src/Service/MealMatcherService.php | 11 ++++- 4 files changed, 83 insertions(+), 10 deletions(-) rename src/Entity/{MealMatcher.php => Product.php} (68%) create mode 100644 src/Repository/ProductRepository.php diff --git a/src/Controller/MealController.php b/src/Controller/MealController.php index c98400c..3061873 100644 --- a/src/Controller/MealController.php +++ b/src/Controller/MealController.php @@ -52,7 +52,7 @@ public function getMealsForCategory(int $categoryId, MealMatcherService $mealMat * @throws GuzzleException */ #[Route('/matches/{mealId}', name: 'wines_for_meals')] - public function getWinesForMeals($mealId, MealMatcherService $mealMatcherService) + public function getWinesForMeals($mealId, MealMatcherService $mealMatcherService): Response { $api = new API("jelmer@grandcruwijnen.nl", "7Wn2okY7!A@mX-DZMmw7tanFaQ*sTGef87o!Gn4_mE6ctiqmLk2hH6LX_deN_K8P7U6LRs7H2BT.cGWvh", "https://beta.grandcruwijnen.dev"); diff --git a/src/Entity/MealMatcher.php b/src/Entity/Product.php similarity index 68% rename from src/Entity/MealMatcher.php rename to src/Entity/Product.php index 6dd8bd8..2983c9f 100644 --- a/src/Entity/MealMatcher.php +++ b/src/Entity/Product.php @@ -2,23 +2,26 @@ namespace App\Entity; - -use ApiPlatform\Core\Annotation\ApiResource; -use App\Repository\MealMatcherRepository; +use App\Repository\ProductRepository; use Doctrine\ORM\Mapping as ORM; /** - * @ORM\Entity(repositoryClass=MealMatcherRepository::class) + * @ORM\Entity(repositoryClass=ProductRepository::class) */ -# -class MealMatcher { +class Product +{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ - private $id; + + /** + * @ORM\Column(type="string", length=255) + */ + private $sku; + /** * @ORM\Column(type="string", length=255) */ @@ -29,12 +32,23 @@ class MealMatcher { */ private $image; - public function getId(): ?int { return $this->id; } + public function getSku(): ?string + { + return $this->sku; + } + + public function setSku(string $sku): self + { + $this->sku = $sku; + + return $this; + } + public function getName(): ?string { return $this->name; diff --git a/src/Repository/ProductRepository.php b/src/Repository/ProductRepository.php new file mode 100644 index 0000000..c34bb70 --- /dev/null +++ b/src/Repository/ProductRepository.php @@ -0,0 +1,50 @@ +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/src/Service/MealMatcherService.php b/src/Service/MealMatcherService.php index 11a5a6e..b852ed7 100644 --- a/src/Service/MealMatcherService.php +++ b/src/Service/MealMatcherService.php @@ -87,12 +87,21 @@ public function getMealsForCategory(int $categoryId) return json_decode($response->getBody()->getContents()); } + /** + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public function getSKU($sku) + { + $response = $this->client->request('GET', '/api/meal_matches?sku=' . $sku . '&limit=30'); + return json_decode($response->getBody()->getContents()); + } + /** * @throws GuzzleException */ public function getWinesForMeal($mealId) { - $response = $this->client->request('GET', '/api/meal_matches?mealId=' . $mealId . '&limit=30', ); + $response = $this->client->request('GET', '/api/meal_matches?mealId=' . $mealId . '&limit=30'); return json_decode($response->getBody()->getContents()); } } \ No newline at end of file From dc5d8e9b70165026b86555226d5b99f79dd97e0a Mon Sep 17 00:00:00 2001 From: Jelmer Date: Sun, 31 Oct 2021 18:45:15 +0100 Subject: [PATCH 04/35] Added ProducCcommand with not yet working code --- public/javascript/script.js | 3 + public/style/style.css | 2 +- src/Command/ProductsCommand.php | 74 ++++++++++++++++++++++++ src/Controller/MealController.php | 7 +-- src/Entity/Product.php | 59 ++++++++++++++----- templates/categories/index.html.twig | 15 ++--- templates/meals/index.html.twig | 33 +++++------ templates/wines/index.html.twig | 84 +++++++++++++--------------- 8 files changed, 188 insertions(+), 89 deletions(-) create mode 100644 public/javascript/script.js create mode 100644 src/Command/ProductsCommand.php diff --git a/public/javascript/script.js b/public/javascript/script.js new file mode 100644 index 0000000..f30653d --- /dev/null +++ b/public/javascript/script.js @@ -0,0 +1,3 @@ +function goBack() { + window.history.back(); +} \ No newline at end of file diff --git a/public/style/style.css b/public/style/style.css index da2a984..f7aab9a 100644 --- a/public/style/style.css +++ b/public/style/style.css @@ -25,7 +25,7 @@ body { display: inline-grid; border: #1111 1px solid; box-shadow: 0 0 5px -1px rgb(0 0 0 / 30%), 0 0 15px -1px rgb(0 0 0 / 25%), 0 0 20px -1px rgb(0 0 0 / 15%); - margin: 4vw 0 0 4vw; + margin: 4vw 0 0 4.5vw; height: 25vh; width: 20vh; border-radius: 10%; diff --git a/src/Command/ProductsCommand.php b/src/Command/ProductsCommand.php new file mode 100644 index 0000000..5a61587 --- /dev/null +++ b/src/Command/ProductsCommand.php @@ -0,0 +1,74 @@ +products = $products; + $this->manager = $manager; + $this->productRepository = $productRepository; + } + + protected function configure(): void + { + $this + ->setDescription(self::$defaultDescription); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + + foreach ($this->products->getProducts()['items'] as $magentoProduct) { + $product = $this->productRepository->findOneBy(['sku' => $magentoProduct['sku']]); + $updatedAt = new DateTime($magentoProduct['updated_at']); + if ($product === null) { + $product = new Product(); + $product + ->setSku($magentoProduct['sku']) + ->setUpdatedAt($updatedAt); + } else { + if ($updatedAt > $product->getUpdatedAt()) { + $product + ->setValid(false) + ->setCheckedSinceUpdate(false); + } + } + + $this->manager->persist($product); + } + + $this->manager->flush(); + + $io->success('Product database updated'); + + return Command::SUCCESS; + } +} \ No newline at end of file diff --git a/src/Controller/MealController.php b/src/Controller/MealController.php index f60a5b1..871f2c3 100644 --- a/src/Controller/MealController.php +++ b/src/Controller/MealController.php @@ -12,8 +12,7 @@ use Symfony\Component\Routing\Annotation\Route; -class MealController extends AbstractController -{ +class MealController extends AbstractController { /** * @throws GuzzleException @@ -57,10 +56,10 @@ public function getMealsForCategory(int $categoryId, MealMatcherService $mealMat #[Route('/matches/{mealId}', name: 'wines_for_meals')] public function getWinesForMeals($mealId, MealMatcherService $mealMatcherService): Response { - $api = new API("jelmer@grandcruwijnen.nl", "7Wn2okY7!A@mX-DZMmw7tanFaQ*sTGef87o!Gn4_mE6ctiqmLk2hH6LX_deN_K8P7U6LRs7H2BT.cGWvh", "https://beta.grandcruwijnen.dev"); $products = new Products($api); - $sku = '01001'; + $product2 = new Products($api); + $sku = '01001-1'; $products = $products->getProduct($sku); return $this->render('wines/index.html.twig', [ diff --git a/src/Entity/Product.php b/src/Entity/Product.php index 2983c9f..1ea2fa7 100644 --- a/src/Entity/Product.php +++ b/src/Entity/Product.php @@ -2,14 +2,14 @@ namespace App\Entity; + use App\Repository\ProductRepository; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity(repositoryClass=ProductRepository::class) */ -class Product -{ +class Product { /** * @ORM\Id * @ORM\GeneratedValue @@ -23,14 +23,33 @@ class Product private $sku; /** - * @ORM\Column(type="string", length=255) + * @ORM\ManyToOne(targetEntity=ExactGroup::class, inversedBy="products") */ - private $name; + private $exactGroup; /** - * @ORM\Column(type="string", length=255) + * @ORM\Column(type="datetime") + */ + private $updatedAt; + + /** + * @ORM\Column(type="boolean") + */ + private $valid; + + /** + * @ORM\Column(type="boolean") + */ + private $checkedSinceUpdate; + + /** + * Product constructor. */ - private $image; + public function __construct() + { + $this->valid = false; + $this->checkedSinceUpdate = false; + } public function getId(): ?int { @@ -49,26 +68,38 @@ public function setSku(string $sku): self return $this; } - public function getName(): ?string + public function getUpdatedAt(): ?\DateTimeInterface + { + return $this->updatedAt; + } + + public function setUpdatedAt(\DateTimeInterface $updatedAt): self + { + $this->updatedAt = $updatedAt; + + return $this; + } + + public function getValid(): ?bool { - return $this->name; + return $this->valid; } - public function setName(string $name): self + public function setValid(bool $valid): self { - $this->name = $name; + $this->valid = $valid; return $this; } - public function getImage(): ?string + public function getCheckedSinceUpdate(): ?bool { - return $this->image; + return $this->checkedSinceUpdate; } - public function setImage(string $image): self + public function setCheckedSinceUpdate(bool $checkedSinceUpdate): self { - $this->image = $image; + $this->checkedSinceUpdate = $checkedSinceUpdate; return $this; } diff --git a/templates/categories/index.html.twig b/templates/categories/index.html.twig index 1b1acf7..cb51329 100644 --- a/templates/categories/index.html.twig +++ b/templates/categories/index.html.twig @@ -6,11 +6,11 @@ {% endblock %} -{% block title %}Hello MealController!{% endblock %} +{% block title %}Online sommelier | Categories!{% endblock %} {% block body %} -
+
{% endblock %} {% block javascripts %} - - + {% endblock %} \ No newline at end of file diff --git a/templates/meals/index.html.twig b/templates/meals/index.html.twig index 67d2420..7b7b6e8 100644 --- a/templates/meals/index.html.twig +++ b/templates/meals/index.html.twig @@ -7,32 +7,38 @@ {% endblock %} -{% block title %}Hello MealController!{% endblock %} +{% block title %}Online sommelier | Meals!{% endblock %} {% block body %} {# https://mealmatcher.grandcruwijnen.nl/meals/%7B12de8bb3-8ce2-43a9-8b09-d56161365ebc%7D #} logo - -
+ +

Welkom bij de online sommelier

Hier kunt u uw gerecht kiezen en dan worden er bijpassende wijnen gezocht.

-
+
{% for meal in meals %} -
- {{ meal.name }} +
+ {{ meal.name }}

{{ meal.name }}

- +
{% endfor %} @@ -43,11 +49,6 @@ {% endblock %} -{% block javascripts%} - - +{% block javascripts %} + {% endblock %} \ No newline at end of file diff --git a/templates/wines/index.html.twig b/templates/wines/index.html.twig index fa8a9fb..ba0405c 100644 --- a/templates/wines/index.html.twig +++ b/templates/wines/index.html.twig @@ -5,14 +5,14 @@ {% endblock %} {% block title %} - The wine matches + Online sommelier | Wines {% endblock %} {% block body %}
@@ -29,58 +29,54 @@

Hier kunt u kiezen uit de best bijpassende wijnen gezocht bij het geselecteerde gerecht.

-
+
+ +

{{ products.name }}

+ + + -
- -

{{ products.name }}

-

€ {{ products.price }}

- - - - - - {% endblock %} + {% block javascripts %} + - - - + function goBack() { + window.history.back(); + } - {% endblock %} + + + + + {% endblock %} From b0714b9882fe32fb24848a603ef6eef3a26955af Mon Sep 17 00:00:00 2001 From: Jelmer Ketelaar Date: Mon, 1 Nov 2021 00:10:16 +0100 Subject: [PATCH 05/35] Fixed error --- composer.lock | 14 +++++------ config/services.yaml | 18 +++++++++++++- src/Command/ProductsCommand.php | 23 ++++++++---------- src/Controller/MealController.php | 24 +++++++++++------- src/Entity/Product.php | 15 ++++-------- src/Migrations/Version20211031224357.php | 31 ++++++++++++++++++++++++ 6 files changed, 85 insertions(+), 40 deletions(-) create mode 100644 src/Migrations/Version20211031224357.php diff --git a/composer.lock b/composer.lock index 17e0e28..c14d711 100644 --- a/composer.lock +++ b/composer.lock @@ -8702,23 +8702,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.7", + "version": "9.2.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" + "reference": "cf04e88a2e3c56fc1a65488afd493325b4c1bc3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cf04e88a2e3c56fc1a65488afd493325b4c1bc3e", + "reference": "cf04e88a2e3c56fc1a65488afd493325b4c1bc3e", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.12.0", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -8767,7 +8767,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.8" }, "funding": [ { @@ -8775,7 +8775,7 @@ "type": "github" } ], - "time": "2021-09-17T05:39:03+00:00" + "time": "2021-10-30T08:01:38+00:00" }, { "name": "phpunit/php-file-iterator", diff --git a/config/services.yaml b/config/services.yaml index ef07b76..98cb617 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -2,7 +2,7 @@ # Files in the packages/ subdirectory configure your dependencies. # 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 +# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration parameters: services: @@ -21,5 +21,21 @@ services: - '../src/Kernel.php' - '../src/Tests/' + # controllers are imported separately to make sure services can be injected + # as action arguments even if you don't extend any base controller class + App\Controller\: + resource: '../src/Controller/' + tags: ['controller.service_arguments'] + # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones + Grandcruwijnen\: + autowire: true + resource: '../vendor/grandcruwijnen/sdk/src/Grandcruwijnen/*' + + Grandcruwijnen\SDK\API: + arguments: + $username: '%env(MAGENTO2_USERNAME)%' + $password: '%env(MAGENTO2_PASSWORD)%' + $baseUri: 'https://www.grandcruwijnen.nl/' + $userAgent: 'Grandcruwijnen.nl Funnel' \ No newline at end of file diff --git a/src/Command/ProductsCommand.php b/src/Command/ProductsCommand.php index 5a61587..da3bf0d 100644 --- a/src/Command/ProductsCommand.php +++ b/src/Command/ProductsCommand.php @@ -6,6 +6,7 @@ use App\Repository\ProductRepository; use DateTime; use Doctrine\ORM\EntityManagerInterface; +use Exception; use Grandcruwijnen\SDK\Products; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -15,14 +16,14 @@ class ProductsCommand extends Command { protected static $defaultName = 'app:fill:products'; - protected static $defaultDescription = 'Fills products database'; +// protected static $defaultDescription = 'Fills products database'; private Products $products; private EntityManagerInterface $manager; private ProductRepository $productRepository; /** - * FillProductsCommand constructor. + * ProductsCommand constructor. * @param Products $products * @param EntityManagerInterface $manager * @param ProductRepository $productRepository @@ -38,10 +39,12 @@ public function __construct(Products $products, EntityManagerInterface $manager, protected function configure(): void { - $this - ->setDescription(self::$defaultDescription); + $this->setDescription(self::$defaultDescription); } + /** + * @throws Exception + */ protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); @@ -51,15 +54,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $updatedAt = new DateTime($magentoProduct['updated_at']); if ($product === null) { $product = new Product(); - $product - ->setSku($magentoProduct['sku']) - ->setUpdatedAt($updatedAt); - } else { - if ($updatedAt > $product->getUpdatedAt()) { - $product - ->setValid(false) - ->setCheckedSinceUpdate(false); - } + $product->setSku($magentoProduct['sku'])->setUpdatedAt($updatedAt); + } else if ($updatedAt > $product->getUpdatedAt()) { + $product->setValid(false)->setCheckedSinceUpdate(false); } $this->manager->persist($product); diff --git a/src/Controller/MealController.php b/src/Controller/MealController.php index 871f2c3..afba8aa 100644 --- a/src/Controller/MealController.php +++ b/src/Controller/MealController.php @@ -3,6 +3,8 @@ namespace App\Controller; +use App\Entity\Product; +use App\Repository\ProductRepository; use App\Service\MealMatcherService; use Grandcruwijnen\SDK\API; use Grandcruwijnen\SDK\Products; @@ -12,7 +14,8 @@ use Symfony\Component\Routing\Annotation\Route; -class MealController extends AbstractController { +class MealController extends AbstractController +{ /** * @throws GuzzleException @@ -50,20 +53,23 @@ public function getMealsForCategory(int $categoryId, MealMatcherService $mealMat return $this->render('meals/index.html.twig', ['meals' => $mealMatcherService->getMealsForCategory($categoryId)]); } + #[Route('/find/{mealId}', name: 'wines_for_meals')] + public function findAllProducts(ProductRepository $productRepository): Response + { + return $this->render('meals/index.html.twig', [ + 'products' => $productRepository->findAll(), + ]); + } + /** * @throws GuzzleException */ - #[Route('/matches/{mealId}', name: 'wines_for_meals')] - public function getWinesForMeals($mealId, MealMatcherService $mealMatcherService): Response + #[Route('matches/{mealId}', name: 'wines_for_meals')] + public function getWinesForMeals(Products $product, $mealId, MealMatcherService $mealMatcherService): Response { $api = new API("jelmer@grandcruwijnen.nl", "7Wn2okY7!A@mX-DZMmw7tanFaQ*sTGef87o!Gn4_mE6ctiqmLk2hH6LX_deN_K8P7U6LRs7H2BT.cGWvh", "https://beta.grandcruwijnen.dev"); $products = new Products($api); - $product2 = new Products($api); - $sku = '01001-1'; - $products = $products->getProduct($sku); - return $this->render('wines/index.html.twig', [ - 'products' => $products, 'matches' => $mealMatcherService->getWinesForMeal($mealId) - ]); + 'products' => $product, $products, 'matches' => $mealMatcherService->getWinesForMeal($mealId)]); } } diff --git a/src/Entity/Product.php b/src/Entity/Product.php index 1ea2fa7..a20c8d0 100644 --- a/src/Entity/Product.php +++ b/src/Entity/Product.php @@ -15,32 +15,27 @@ class Product { * @ORM\GeneratedValue * @ORM\Column(type="integer") */ - private $id; + private int $id; /** * @ORM\Column(type="string", length=255) */ - private $sku; - - /** - * @ORM\ManyToOne(targetEntity=ExactGroup::class, inversedBy="products") - */ - private $exactGroup; + private ?string $sku; /** * @ORM\Column(type="datetime") */ - private $updatedAt; + private ?\DateTimeInterface $updatedAt; /** * @ORM\Column(type="boolean") */ - private $valid; + private bool $valid; /** * @ORM\Column(type="boolean") */ - private $checkedSinceUpdate; + private bool $checkedSinceUpdate; /** * Product constructor. diff --git a/src/Migrations/Version20211031224357.php b/src/Migrations/Version20211031224357.php new file mode 100644 index 0000000..bafd73a --- /dev/null +++ b/src/Migrations/Version20211031224357.php @@ -0,0 +1,31 @@ +addSql('CREATE TABLE product (id INT AUTO_INCREMENT NOT NULL, sku VARCHAR(255) NOT NULL, updated_at DATETIME NOT NULL, valid TINYINT(1) NOT NULL, checked_since_update TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE product'); + } +} From ef62fb6eedcd0fe0c034944e3a83de964e8494f7 Mon Sep 17 00:00:00 2001 From: Jelmer Date: Mon, 1 Nov 2021 11:54:06 +0100 Subject: [PATCH 06/35] Updated files --- config/services.yaml | 4 ++-- src/Service/MealMatcherService.php | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/config/services.yaml b/config/services.yaml index 98cb617..d889d36 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -31,11 +31,11 @@ services: # please note that last definitions always *replace* previous ones Grandcruwijnen\: autowire: true - resource: '../vendor/grandcruwijnen/sdk/src/Grandcruwijnen/*' + resource: '.../vendor/grandcruwijnen/sdk/src/Grandcruwijnen/*' Grandcruwijnen\SDK\API: arguments: $username: '%env(MAGENTO2_USERNAME)%' $password: '%env(MAGENTO2_PASSWORD)%' - $baseUri: 'https://www.grandcruwijnen.nl/' + $baseUri: 'https://beta.grandcruwijnen.dev/' $userAgent: 'Grandcruwijnen.nl Funnel' \ No newline at end of file diff --git a/src/Service/MealMatcherService.php b/src/Service/MealMatcherService.php index 7fc460d..e66c571 100644 --- a/src/Service/MealMatcherService.php +++ b/src/Service/MealMatcherService.php @@ -6,8 +6,7 @@ use GuzzleHttp\Client; use GuzzleHttp\Exception\GuzzleException; -class MealMatcherService -{ +class MealMatcherService { private Client $client; public function __construct() @@ -15,9 +14,6 @@ public function __construct() $this->client = new Client(['base_uri' => 'https://mealmatcher.grandcruwijnen.nl']); } - /** - * @throws \GuzzleHttp\Exception\GuzzleException - */ public function getIndexPage() { return 'landing/index.html.twig'; @@ -31,8 +27,10 @@ public function getParentMealCategories(): array $categories = $this->getMealsCategories(); $parentCategories = []; - foreach ($categories as $category) { - if ($category->parent === null) { + foreach ($categories as $category) + { + if ($category->parent === null) + { $parentCategories[] = $category; } } @@ -63,8 +61,10 @@ public function getCategoriesForParent(int $parentId): array $categories = $this->getMealsCategories(); $childCategories = []; - foreach ($categories as $category) { - if ($category->parent !== null && $category->parent->categoryId === $parentId) { + foreach ($categories as $category) + { + if ($category->parent !== null && $category->parent->categoryId === $parentId) + { $childCategories[] = $category; } } @@ -81,12 +81,14 @@ public function getMealsForCategory(int $categoryId) return json_decode($response->getBody()->getContents()); } + /** - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws GuzzleException */ public function getSKU($sku) { $response = $this->client->request('GET', '/api/meal_matches?sku=' . $sku . '&limit=30'); + return json_decode($response->getBody()->getContents()); } @@ -96,6 +98,7 @@ public function getSKU($sku) public function getWinesForMeal($mealId) { $response = $this->client->request('GET', '/api/meal_matches?mealId=' . $mealId . '&limit=30'); + return json_decode($response->getBody()->getContents()); } } \ No newline at end of file From 3ba14bc92f0b7de900988f601706cec9950b5f95 Mon Sep 17 00:00:00 2001 From: Jelmer Date: Mon, 1 Nov 2021 22:26:01 +0100 Subject: [PATCH 07/35] Added the functionality to see the right wines by the meal --- config/services.yaml | 3 +- src/Command/ProductsCommand.php | 36 ++++++-- src/Controller/MealController.php | 33 ++++--- src/Entity/Product.php | 85 +++++++++++++++++++ src/Migrations/Version20211019072649.php | 31 ------- ...31224357.php => Version20211101132517.php} | 2 +- ...18145712.php => Version20211101133620.php} | 8 +- src/Migrations/Version20211101162016.php | 31 +++++++ src/Service/MealMatcherService.php | 4 +- templates/wines/index.html.twig | 14 +-- 10 files changed, 180 insertions(+), 67 deletions(-) delete mode 100644 src/Migrations/Version20211019072649.php rename src/Migrations/{Version20211031224357.php => Version20211101132517.php} (93%) rename src/Migrations/{Version20211018145712.php => Version20211101133620.php} (59%) create mode 100644 src/Migrations/Version20211101162016.php diff --git a/config/services.yaml b/config/services.yaml index d889d36..bd911d1 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -20,6 +20,7 @@ services: - '../src/Entity/' - '../src/Kernel.php' - '../src/Tests/' + - '../src/Migrations/' # controllers are imported separately to make sure services can be injected # as action arguments even if you don't extend any base controller class @@ -31,7 +32,7 @@ services: # please note that last definitions always *replace* previous ones Grandcruwijnen\: autowire: true - resource: '.../vendor/grandcruwijnen/sdk/src/Grandcruwijnen/*' + resource: '../vendor/grandcruwijnen/sdk/src/Grandcruwijnen/*' Grandcruwijnen\SDK\API: arguments: diff --git a/src/Command/ProductsCommand.php b/src/Command/ProductsCommand.php index da3bf0d..706196a 100644 --- a/src/Command/ProductsCommand.php +++ b/src/Command/ProductsCommand.php @@ -2,21 +2,22 @@ namespace App\Command; + use App\Entity\Product; use App\Repository\ProductRepository; use DateTime; use Doctrine\ORM\EntityManagerInterface; use Exception; use Grandcruwijnen\SDK\Products; +use GuzzleHttp\Exception\GuzzleException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -class ProductsCommand extends Command -{ +class ProductsCommand extends Command { protected static $defaultName = 'app:fill:products'; -// protected static $defaultDescription = 'Fills products database'; + protected static $defaultDescription = 'Fills products database'; private Products $products; private EntityManagerInterface $manager; @@ -44,19 +45,36 @@ protected function configure(): void /** * @throws Exception + * @throws GuzzleException */ protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); - - foreach ($this->products->getProducts()['items'] as $magentoProduct) { + $items = $this->products->getProducts()['items']; + foreach ($items as $magentoProduct) + { + if($magentoProduct['status'] !== 1) { + continue; + } $product = $this->productRepository->findOneBy(['sku' => $magentoProduct['sku']]); $updatedAt = new DateTime($magentoProduct['updated_at']); - if ($product === null) { +// $io->comment($magentoProduct['sku']); + if ($product === null) + { $product = new Product(); - $product->setSku($magentoProduct['sku'])->setUpdatedAt($updatedAt); - } else if ($updatedAt > $product->getUpdatedAt()) { - $product->setValid(false)->setCheckedSinceUpdate(false); + $product + ->setSku($magentoProduct['sku']) + ->setUpdatedAt($updatedAt) + ->setName($magentoProduct['name']) + ->setDescription("Test beschrijving") + ->setPrice($magentoProduct["price"]) + ->setStock(1) + ->setScore(1); + } else if ($updatedAt > $product->getUpdatedAt()) + { + $product + ->setValid(false) + ->setCheckedSinceUpdate(false); } $this->manager->persist($product); diff --git a/src/Controller/MealController.php b/src/Controller/MealController.php index afba8aa..e5279f8 100644 --- a/src/Controller/MealController.php +++ b/src/Controller/MealController.php @@ -14,8 +14,7 @@ use Symfony\Component\Routing\Annotation\Route; -class MealController extends AbstractController -{ +class MealController extends AbstractController { /** * @throws GuzzleException @@ -53,23 +52,29 @@ public function getMealsForCategory(int $categoryId, MealMatcherService $mealMat return $this->render('meals/index.html.twig', ['meals' => $mealMatcherService->getMealsForCategory($categoryId)]); } - #[Route('/find/{mealId}', name: 'wines_for_meals')] - public function findAllProducts(ProductRepository $productRepository): Response - { - return $this->render('meals/index.html.twig', [ - 'products' => $productRepository->findAll(), - ]); - } - /** * @throws GuzzleException */ #[Route('matches/{mealId}', name: 'wines_for_meals')] - public function getWinesForMeals(Products $product, $mealId, MealMatcherService $mealMatcherService): Response + public function getWinesForMeals(ProductRepository $products, $mealId, MealMatcherService $mealMatcherService): Response { - $api = new API("jelmer@grandcruwijnen.nl", "7Wn2okY7!A@mX-DZMmw7tanFaQ*sTGef87o!Gn4_mE6ctiqmLk2hH6LX_deN_K8P7U6LRs7H2BT.cGWvh", "https://beta.grandcruwijnen.dev"); - $products = new Products($api); + $matches = []; + $score = ''; +// dd($mealMatcherService->getWinesForMeal($mealId)); + foreach ($mealMatcherService->getWinesForMeal($mealId) as $wine) + { + $product = $products->findOneBy(['sku' => $wine->wine->sku]); + if ($product !== null) + { + $matches[] = $product; +// $score'' = $product; + $score = $wine->score; + //TODO: Scores toevoegen aan de wijn + } + } + return $this->render('wines/index.html.twig', [ - 'products' => $product, $products, 'matches' => $mealMatcherService->getWinesForMeal($mealId)]); + 'matches' => $matches, $score + ]); } } diff --git a/src/Entity/Product.php b/src/Entity/Product.php index a20c8d0..a750413 100644 --- a/src/Entity/Product.php +++ b/src/Entity/Product.php @@ -37,6 +37,31 @@ class Product { */ private bool $checkedSinceUpdate; + /** + * @ORM\Column(type="string", length=255) + */ + private $name; + + /** + * @ORM\Column(type="text") + */ + private $description; + + /** + * @ORM\Column(type="float") + */ + private $price; + + /** + * @ORM\Column(type="integer") + */ + private $stock; + + /** + * @ORM\Column(type="string", length=255) + */ + private $score; + /** * Product constructor. */ @@ -98,4 +123,64 @@ public function setCheckedSinceUpdate(bool $checkedSinceUpdate): self return $this; } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(string $description): self + { + $this->description = $description; + + return $this; + } + + public function getPrice(): ?float + { + return $this->price; + } + + public function setPrice(float $price): self + { + $this->price = $price; + + return $this; + } + + public function getStock(): ?int + { + return $this->stock; + } + + public function setStock(int $stock): self + { + $this->stock = $stock; + + return $this; + } + + public function getScore(): ?string + { + return $this->score; + } + + public function setScore(string $score): self + { + $this->score = $score; + + return $this; + } } diff --git a/src/Migrations/Version20211019072649.php b/src/Migrations/Version20211019072649.php deleted file mode 100644 index 2da9334..0000000 --- a/src/Migrations/Version20211019072649.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('CREATE TABLE meal_matcher (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, image VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('DROP TABLE meal_matcher'); - } -} diff --git a/src/Migrations/Version20211031224357.php b/src/Migrations/Version20211101132517.php similarity index 93% rename from src/Migrations/Version20211031224357.php rename to src/Migrations/Version20211101132517.php index bafd73a..b693b66 100644 --- a/src/Migrations/Version20211031224357.php +++ b/src/Migrations/Version20211101132517.php @@ -10,7 +10,7 @@ /** * Auto-generated Migration: Please modify to your needs! */ -final class Version20211031224357 extends AbstractMigration +final class Version20211101132517 extends AbstractMigration { public function getDescription(): string { diff --git a/src/Migrations/Version20211018145712.php b/src/Migrations/Version20211101133620.php similarity index 59% rename from src/Migrations/Version20211018145712.php rename to src/Migrations/Version20211101133620.php index 5883abf..82cfc3b 100644 --- a/src/Migrations/Version20211018145712.php +++ b/src/Migrations/Version20211101133620.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Migrations; +namespace DoctrineMigrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; @@ -10,7 +10,7 @@ /** * Auto-generated Migration: Please modify to your needs! */ -final class Version20211018145712 extends AbstractMigration +final class Version20211101133620 extends AbstractMigration { public function getDescription(): string { @@ -20,12 +20,12 @@ public function getDescription(): string public function up(Schema $schema): void { // this up() migration is auto-generated, please modify it to your needs - + $this->addSql('ALTER TABLE product ADD name VARCHAR(255) NOT NULL, ADD description LONGTEXT NOT NULL, ADD price DOUBLE PRECISION NOT NULL, ADD stock INT NOT NULL'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs - + $this->addSql('ALTER TABLE product DROP name, DROP description, DROP price, DROP stock'); } } diff --git a/src/Migrations/Version20211101162016.php b/src/Migrations/Version20211101162016.php new file mode 100644 index 0000000..180da4c --- /dev/null +++ b/src/Migrations/Version20211101162016.php @@ -0,0 +1,31 @@ +addSql('CREATE TABLE product (id INT AUTO_INCREMENT NOT NULL, sku VARCHAR(255) NOT NULL, updated_at DATETIME NOT NULL, valid TINYINT(1) NOT NULL, checked_since_update TINYINT(1) NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT NOT NULL, price DOUBLE PRECISION NOT NULL, stock INT NOT NULL, score VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE product'); + } +} diff --git a/src/Service/MealMatcherService.php b/src/Service/MealMatcherService.php index e66c571..f63a94a 100644 --- a/src/Service/MealMatcherService.php +++ b/src/Service/MealMatcherService.php @@ -14,7 +14,7 @@ public function __construct() $this->client = new Client(['base_uri' => 'https://mealmatcher.grandcruwijnen.nl']); } - public function getIndexPage() + public function getIndexPage(): string { return 'landing/index.html.twig'; } @@ -97,7 +97,7 @@ public function getSKU($sku) */ public function getWinesForMeal($mealId) { - $response = $this->client->request('GET', '/api/meal_matches?mealId=' . $mealId . '&limit=30'); + $response = $this->client->request('GET', '/api/meal_matches?meal=' . $mealId . '&limit=30'); return json_decode($response->getBody()->getContents()); } diff --git a/templates/wines/index.html.twig b/templates/wines/index.html.twig index ba0405c..dd72bd2 100644 --- a/templates/wines/index.html.twig +++ b/templates/wines/index.html.twig @@ -31,13 +31,15 @@
+ {% for product in matches %} +
-

{{ products.name }}

+

{{ product.name }}

- - +
+ {% endfor %}
+ {% endblock %} {% block javascripts %} From 5932465a7d7886f581e01239d28a88e740ab95b0 Mon Sep 17 00:00:00 2001 From: Jelmer Date: Mon, 1 Nov 2021 22:26:05 +0100 Subject: [PATCH 08/35] Create README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..3e8f7ef --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +1. composer install +2. bin/console doctrine:migrations:migrate +3. php -d memory_limit=-1 bin/console app:fill:products From 0f4e1686b7049b402f93ad9f3af6863b3e489f9a Mon Sep 17 00:00:00 2001 From: Jelmer Ketelaar Date: Mon, 1 Nov 2021 22:41:30 +0100 Subject: [PATCH 09/35] Update style.css --- public/style/style.css | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/style/style.css b/public/style/style.css index f7aab9a..3dcce5a 100644 --- a/public/style/style.css +++ b/public/style/style.css @@ -1,6 +1,5 @@ body { font-family: 'Montserrat', sans-serif; - height: 100%; width: 100%; background-color: #e9dcd1; } @@ -62,5 +61,9 @@ h1 { } .logo { - margin: 30px 30px 30px -15vw; + margin: 30px 30px 30px -12vw; } + +.content { + height: 100vh !important; +} \ No newline at end of file From 66f7f85f21367e8b114c98d7d0a23b374c52bd98 Mon Sep 17 00:00:00 2001 From: Jelmer Date: Tue, 2 Nov 2021 09:41:41 +0100 Subject: [PATCH 10/35] Update style.css --- public/style/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/style/style.css b/public/style/style.css index 3dcce5a..2dc385a 100644 --- a/public/style/style.css +++ b/public/style/style.css @@ -61,7 +61,7 @@ h1 { } .logo { - margin: 30px 30px 30px -12vw; + margin: 30px 30px 30px -10vw; } .content { From d4b60f56752d1753eabdda8165099aeedf154898 Mon Sep 17 00:00:00 2001 From: Jelmer Date: Tue, 2 Nov 2021 09:43:40 +0100 Subject: [PATCH 11/35] Update index.html.twig --- templates/wines/index.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/wines/index.html.twig b/templates/wines/index.html.twig index dd72bd2..75a68e8 100644 --- a/templates/wines/index.html.twig +++ b/templates/wines/index.html.twig @@ -17,7 +17,7 @@
logo + alt='logo' style='margin: 30px 30px 30px -10vw;'> From ff141219ec830a64ede5d6afd844637eb0780011 Mon Sep 17 00:00:00 2001 From: Kingston Date: Tue, 2 Nov 2021 09:58:10 +0100 Subject: [PATCH 12/35] Styling info button as designed --- public/style/style.css | 2 +- templates/wines/index.html.twig | 32 +++++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/public/style/style.css b/public/style/style.css index 3dcce5a..778d9d8 100644 --- a/public/style/style.css +++ b/public/style/style.css @@ -61,7 +61,7 @@ h1 { } .logo { - margin: 30px 30px 30px -12vw; + margin: 30px 30px 30px 0px; } .content { diff --git a/templates/wines/index.html.twig b/templates/wines/index.html.twig index dd72bd2..730d996 100644 --- a/templates/wines/index.html.twig +++ b/templates/wines/index.html.twig @@ -17,7 +17,7 @@
logo + alt='logo' style='margin: 30px 30px 30px 0px;'> @@ -48,18 +48,40 @@