diff --git a/.travis.yml b/.travis.yml index 88326f0..7406d6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,14 +31,14 @@ before_install: install: - composer require "sylius/sylius:${SYLIUS_VERSION}" --no-interaction --no-update - composer update --no-interaction --prefer-dist - - (cd tests/Application && yarn install) +# - (cd tests/Application && yarn install) before_script: - (cd tests/Application && bin/console doctrine:database:create --env=test -vvv) - (cd tests/Application && bin/console doctrine:schema:create --env=test -vvv) - # - (cd tests/Application && bin/console assets:install web --env=test -vvv) - - (cd tests/Application && bin/console cache:warmup --env=test -vvv) - - (cd tests/Application && yarn build) + - (cd tests/Application && bin/console assets:install public --env=test -vvv) + - (cd tests/Application && bin/console cache:clear --env=test -vvv) +# - (cd tests/Application && yarn build) # Run webserver - (cd tests/Application && bin/console server:run 127.0.0.1:8080 -d web --env=test --quiet > /dev/null 2>&1 &) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31f9815..16cba5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # CHANGELOG +## v1.2.0 (2020-09-03) + +#### Details + +- Add event after bulk category assignment. (Eg. for update products in elasticsearch) + +## v1.1.1 (2020-06-08) + +#### Details + +- CS translations + +## v1.1.0 (2020-06-08) + +#### Details + +- Batch assign categories to products + ## v1.0.0 (2020-04-28) #### Details diff --git a/README.md b/README.md index ae7f802..fc4e993 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,9 @@ Run `src/Migrations/basic-data/timezones-data.sql` for load the timezones table. * `mango-sylius-extended-channels.duplicate.product.after-persist` * `mango-sylius-extended-channels.duplicate.product-variant.before-persist` * `mango-sylius-extended-channels.duplicate.product-variant.after-persist` + +* You can use event after bulk category assignment + * `mango-sylius-extended-channels.products.after_bulk_categories` * You can change the types of Hello bars ```yaml diff --git a/src/Controller/ManageProductCategoriesController.php b/src/Controller/ManageProductCategoriesController.php index 3b7ac31..1486e41 100644 --- a/src/Controller/ManageProductCategoriesController.php +++ b/src/Controller/ManageProductCategoriesController.php @@ -9,6 +9,8 @@ use Sylius\Component\Core\Model\ProductInterface; use Sylius\Component\Core\Repository\ProductRepositoryInterface; use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\EventDispatcher\GenericEvent; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -49,6 +51,11 @@ class ManageProductCategoriesController */ private $formFactory; + /** + * @var EventDispatcherInterface + */ + private $eventDispatcher; + public function __construct( TranslatorInterface $translator, FlashBagInterface $flashBag, @@ -56,7 +63,8 @@ public function __construct( ProductRepositoryInterface $productRepository, EngineInterface $templatingEngine, EntityManagerInterface $entityManager, - FormFactoryInterface $formFactory + FormFactoryInterface $formFactory, + EventDispatcherInterface $eventDispatcher ) { $this->router = $router; $this->flashBag = $flashBag; @@ -65,6 +73,7 @@ public function __construct( $this->templatingEngine = $templatingEngine; $this->entityManager = $entityManager; $this->formFactory = $formFactory; + $this->eventDispatcher = $eventDispatcher; } public function bulkManageProductCategories(Request $request): Response @@ -85,6 +94,10 @@ public function bulkManageProductCategories(Request $request): Response $message = $this->translator->trans('mango-sylius.admin.manage_product_categories.saved'); $this->flashBag->add('success', $message); + // Eg. for update products in elasticsearch + $event = new GenericEvent($productIds); + $this->eventDispatcher->dispatch('mango-sylius-extended-channels.products.after_bulk_categories', $event); + return new RedirectResponse($this->router->generate('sylius_admin_product_index')); } diff --git a/src/Resources/config/services.yml b/src/Resources/config/services.yml index c8a627a..c07ffb7 100644 --- a/src/Resources/config/services.yml +++ b/src/Resources/config/services.yml @@ -135,6 +135,7 @@ services: $templatingEngine: '@templating' $entityManager: '@doctrine.orm.default_entity_manager' $formFactory: '@form.factory' + $eventDispatcher: '@event_dispatcher' MangoSylius\ExtendedChannelsPlugin\Service\ProductDuplicator: arguments: diff --git a/tests/Application/package.json b/tests/Application/package.json index cf31724..ce58718 100644 --- a/tests/Application/package.json +++ b/tests/Application/package.json @@ -1,57 +1,58 @@ { - "dependencies": { - "babel-polyfill": "^6.26.0", - "jquery": "^3.2.0", - "lightbox2": "^2.9.0", - "semantic-ui-css": "^2.2.0", - "chart.js": "^2.9.3", - "slick-carousel": "^1.8.1" - }, - "devDependencies": { - "babel-core": "^6.26.3", - "babel-plugin-external-helpers": "^6.22.0", - "babel-plugin-module-resolver": "^3.1.1", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-preset-env": "^1.7.0", - "babel-register": "^6.26.0", - "dedent": "^0.7.0", - "eslint": "^4.19.1", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-import-resolver-babel-module": "^4.0.0", - "eslint-plugin-import": "^2.12.0", - "fast-async": "^6.3.7", - "gulp": "^4.0.0", - "gulp-chug": "^0.5", - "gulp-concat": "^2.6.0", - "gulp-debug": "^2.1.2", - "gulp-if": "^2.0.0", - "gulp-livereload": "^3.8.1", - "gulp-order": "^1.1.1", - "gulp-sass": "^4.0.1", - "gulp-sourcemaps": "^1.6.0", - "gulp-uglifycss": "^1.0.5", - "merge-stream": "^1.0.0", - "rollup": "^0.60.7", - "rollup-plugin-babel": "^3.0.4", - "rollup-plugin-commonjs": "^9.1.3", - "rollup-plugin-inject": "^2.0.0", - "rollup-plugin-node-resolve": "^3.3.0", - "rollup-plugin-uglify": "^4.0.0", - "upath": "^1.1.0", - "yargs": "^6.4.0", - "@symfony/webpack-encore": "^0.28.0", - "sass-loader": "^7.0.1" - }, - "scripts": { - "build": "gulp build", - "gulp": "gulp build", - "lint": "yarn lint:js", - "lint:js": "eslint gulpfile.babel.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Sylius/Sylius.git" - }, - "author": "Paweł Jędrzejewski", - "license": "MIT" + "dependencies": { + "babel-polyfill": "^6.26.0", + "chart.js": "^2.9.3", + "jquery": "^3.4.0", + "jquery.dirtyforms": "^2.0.0", + "lightbox2": "^2.9.0", + "semantic-ui-css": "^2.2.0", + "slick-carousel": "^1.8.1" + }, + "devDependencies": { + "@symfony/webpack-encore": "^0.28.0", + "babel-core": "^6.26.3", + "babel-plugin-external-helpers": "^6.22.0", + "babel-plugin-module-resolver": "^3.1.1", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.7.0", + "babel-register": "^6.26.0", + "dedent": "^0.7.0", + "eslint": "^4.19.1", + "eslint-config-airbnb-base": "^12.1.0", + "eslint-import-resolver-babel-module": "^4.0.0", + "eslint-plugin-import": "^2.11.0", + "fast-async": "^6.3.7", + "gulp": "^4.0.0", + "gulp-chug": "^0.5", + "gulp-concat": "^2.6.0", + "gulp-debug": "^2.1.2", + "gulp-if": "^2.0.0", + "gulp-livereload": "^4.0.1", + "gulp-order": "^1.1.1", + "gulp-sass": "^4.0.1", + "gulp-sourcemaps": "^1.6.0", + "gulp-uglifycss": "^1.0.5", + "merge-stream": "^1.0.0", + "rollup": "^0.60.2", + "rollup-plugin-babel": "^3.0.4", + "rollup-plugin-commonjs": "^9.1.3", + "rollup-plugin-inject": "^2.0.0", + "rollup-plugin-node-resolve": "^3.3.0", + "rollup-plugin-uglify": "^4.0.0", + "sass-loader": "^7.0.1", + "upath": "^1.1.0", + "yargs": "^6.4.0" + }, + "scripts": { + "build": "gulp build", + "gulp": "gulp build", + "lint": "yarn lint:js", + "lint:js": "eslint gulpfile.babel.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Sylius/Sylius.git" + }, + "author": "Paweł Jędrzejewski", + "license": "MIT" } diff --git a/tests/Behat/Resources/suites.yml b/tests/Behat/Resources/suites.yml index d398cf2..61fd6f3 100644 --- a/tests/Behat/Resources/suites.yml +++ b/tests/Behat/Resources/suites.yml @@ -1,9 +1,9 @@ imports: - suites/mark_taxon_as_external_link.yml -# - suites/managing_channel.yml -# - suites/send_order_email_to_bcc_email.yml -# - suites/cancel_unpaid_orders_for_certain_payment_method.yml -# - suites/update_product_prices_using_exchange_rates.yml -# - suites/download_current_exchange_rates.yml -# - suites/duplicate_product.yml -# - suites/duplicate_product_variant.yml + - suites/managing_channel.yml + - suites/send_order_email_to_bcc_email.yml + - suites/cancel_unpaid_orders_for_certain_payment_method.yml + - suites/update_product_prices_using_exchange_rates.yml + - suites/download_current_exchange_rates.yml + - suites/duplicate_product.yml + - suites/duplicate_product_variant.yml