Skip to content

Commit 3bf8971

Browse files
authored
Merge pull request #268 from BitBagCommerce/upgrade-to-20
Sylius 2.0 support
2 parents 118592a + 9b4bcf7 commit 3bf8971

File tree

147 files changed

+2771
-1702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+2771
-1702
lines changed

.github/workflows/build.yml

+11-15
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'dependabot/**'
77
pull_request: ~
88
release:
9-
types: [ created ]
9+
types: [created]
1010
schedule:
1111
- cron: "0 1 * * 6" # Run at 1am every Saturday
1212
workflow_dispatch: ~
@@ -20,11 +20,11 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
php: [ "8.1", "8.2", "8.3" ]
24-
symfony: [ "^5.4", "^6.0" ]
25-
sylius: [ "~1.13.0", "~1.14.0" ]
26-
node: [ "18.x", "20.x" ]
27-
mysql: [ "5.7", "8.0" ]
23+
php: [ "8.2", "8.3" ]
24+
symfony: [ "^7.1" ]
25+
sylius: [ "^2.0" ]
26+
node: [ "20.x" ]
27+
mysql: [ "8.0" ]
2828
env:
2929
APP_ENV: test
3030
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"
@@ -76,7 +76,7 @@ jobs:
7676
run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 &
7777

7878
- name: Run webserver
79-
run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon)
79+
run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon && symfony -V)
8080

8181
- name: Get Composer cache directory
8282
id: composer-cache
@@ -104,9 +104,6 @@ jobs:
104104
- name: Install PHP dependencies
105105
run: composer install --no-interaction --no-scripts
106106

107-
- name: Install Behat driver
108-
run: vendor/bin/bdi browser:google-chrome drivers
109-
110107
- name: Get Yarn cache directory
111108
id: yarn-cache
112109
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -150,13 +147,11 @@ jobs:
150147
- name: Run PHPUnit
151148
run: vendor/bin/phpunit --colors=always
152149

153-
- name: Run Behat
154-
if: ${{ matrix.sylius != '^1.13.0' }}
155-
run: vendor/bin/behat --colors --strict -vvv --no-interaction --tags '~@sylius113' || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun --tags '~@sylius113'
150+
- name: Create behat logs directory
151+
run: (mkdir -p etc/build && chmod a+rw etc/build )
156152

157153
- name: Run Behat
158-
if: ${{ matrix.sylius == '^1.13.0' }}
159-
run: vendor/bin/behat --colors --strict -vvv --no-interaction --tags '~@sylius112' || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun --tags '~@sylius112'
154+
run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun
160155

161156
- name: Upload Behat logs
162157
uses: actions/upload-artifact@v4
@@ -165,6 +160,7 @@ jobs:
165160
name: Behat logs
166161
path: etc/build/
167162
if-no-files-found: ignore
163+
overwrite: true
168164

169165
- name: Run PHPUnit
170166
run: vendor/bin/phpunit --colors=always

.github/workflows/coding_standard.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
php: [ "8.1", "8.2", "8.3" ]
22-
symfony: [ "^5.4", "^6.4" ]
23-
sylius: [ "^1.12", "^1.13", "^1.14" ]
24-
node: [ "18.x", "20.x" ]
21+
php: [ "8.2", "8.3" ]
22+
symfony: [ "^7.1" ]
23+
sylius: [ "^2.0" ]
24+
node: [ "20.x" ]
2525

2626
steps:
2727
- uses: actions/checkout@v3

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:20.04
22
ARG DEBIAN_FRONTEND=noninteractive
3-
ARG PHP_VERSION=8.1
3+
ARG PHP_VERSION=8.2
44
ENV LC_ALL=C.UTF-8
55

66
# Install basic tools
@@ -16,7 +16,7 @@ RUN apt-get update && apt-get install -y \
1616
# Append NODE, NGINX and PHP repositories
1717
RUN add-apt-repository ppa:ondrej/php \
1818
&& add-apt-repository ppa:ondrej/nginx \
19-
&& curl -sL https://deb.nodesource.com/setup_14.x | bash -
19+
&& curl -sL https://deb.nodesource.com/setup_20.x | bash -
2020

2121
# Install required PHP extensions
2222
RUN apt-get update && apt-get install -y \
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
import './scss/main.scss'
2-
import './js/'
2+
import './js'
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
import './scss/main.scss'
2-
import './js/'
2+
import './js'

assets/shop/entrypoint.js

Whitespace-only changes.
File renamed without changes.

src/Resources/assets/shop/scss/elasticSearchAutocomplete.scss assets/shop/scss/elasticSearchAutocomplete.scss

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
left: 50%;
99
-webkit-transform: translateX(-50%);
1010
transform: translateX(-50%);
11-
min-width: 100%;
1211
width: 600px;
1312
padding: 0 1rem 0 1rem;
1413
background-color: white;

assets/shop/scss/main.scss

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import 'elasticSearchAutocomplete';
2+

composer.json

+94-96
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,99 @@
11
{
2-
"name": "bitbag/elasticsearch-plugin",
3-
"type": "sylius-plugin",
4-
"description": "BitBag Elasticsearch plugin for Sylius.",
5-
"license": "MIT",
6-
"require": {
7-
"php": "^8.1",
8-
"ext-json": "*",
9-
"friendsofsymfony/elastica-bundle": "^6.0",
10-
"sylius/sylius": "~1.13.0 || ~1.14.0",
11-
"symfony/property-access": "^5.4 || ^6.0",
12-
"symfony/webpack-encore-bundle": "^1.15",
13-
"symfony/proxy-manager-bridge": "^5.4 || ^6.0"
14-
},
15-
"require-dev": {
16-
"behat/behat": "^3.6.1",
17-
"behat/mink-selenium2-driver": "^1.4",
18-
"bitbag/coding-standard": "^v2.0",
19-
"dbrekelmans/bdi": "^1.1",
20-
"dmore/behat-chrome-extension": "^1.3",
21-
"dmore/chrome-mink-driver": "^2.7",
22-
"friends-of-behat/mink": "^1.8",
23-
"friends-of-behat/mink-browserkit-driver": "^1.4",
24-
"friends-of-behat/mink-debug-extension": "^2.0.0",
25-
"friends-of-behat/mink-extension": "^2.4",
26-
"friends-of-behat/page-object-extension": "^0.3",
27-
"friends-of-behat/suite-settings-extension": "^1.0",
28-
"friends-of-behat/symfony-extension": "^2.1",
29-
"friends-of-behat/variadic-extension": "^1.3",
30-
"league/flysystem-bundle": "2.4.0",
31-
"lchrusciel/api-test-case": "^5.2",
32-
"phpspec/phpspec": "^7.2",
33-
"phpstan/extension-installer": "^1.0",
34-
"phpstan/phpstan": "^1.8.1",
35-
"phpstan/phpstan-doctrine": "1.3.69",
36-
"phpstan/phpstan-strict-rules": "^1.3.0",
37-
"phpstan/phpstan-webmozart-assert": "^1.2.0",
38-
"phpunit/phpunit": "^9.0 || ^10.0",
39-
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
40-
"robertfausk/behat-panther-extension": "^1.1",
41-
"sylius-labs/coding-standard": "^4.2",
42-
"sylius-labs/suite-tags-extension": "^0.2",
43-
"symfony/browser-kit": "^5.4 || ^6.0",
44-
"symfony/debug-bundle": "^5.4 || ^6.0",
45-
"symfony/dotenv": "^5.4 || ^6.0",
46-
"symfony/intl": "^5.4 || ^6.0",
47-
"symfony/web-profiler-bundle": "^5.4 || ^6.0"
48-
},
49-
"conflict": {
50-
"api-platform/core": "v2.7.17",
51-
"symfony/framework-bundle": "6.2.8",
52-
"behat/mink-selenium2-driver": ">=1.7.0"
53-
},
54-
"config": {
55-
"sort-packages": true,
56-
"allow-plugins": {
57-
"symfony/thanks": true,
58-
"composer/package-versions-deprecated": true,
59-
"dealerdirect/phpcodesniffer-composer-installer": true,
60-
"phpstan/extension-installer": true
61-
}
62-
},
63-
"extra": {
64-
"branch-alias": {
65-
"dev-master": "1.13-dev"
66-
},
67-
"symfony": {
68-
"require": "^5.4 || ^6.0"
69-
}
70-
},
71-
"autoload": {
72-
"psr-4": {
73-
"BitBag\\SyliusElasticsearchPlugin\\": "src/",
74-
"Tests\\BitBag\\SyliusElasticsearchPlugin\\Application\\": "tests/Application",
75-
"Tests\\BitBag\\SyliusElasticsearchPlugin\\Integration\\": "tests/PHPUnit/Integration"
76-
}
2+
"name": "bitbag/elasticsearch-plugin",
3+
"type": "sylius-plugin",
4+
"description": "BitBag Elasticsearch plugin for Sylius.",
5+
"license": "MIT",
6+
"require": {
7+
"php": "^8.2 || ^8.3",
8+
"ext-json": "*",
9+
"friendsofsymfony/elastica-bundle": "^6.0",
10+
"sylius/sylius": "~2.0.0",
11+
"symfony/property-access": "^7.1",
12+
"symfony/webpack-encore-bundle": "^2.2"
13+
},
14+
"require-dev": {
15+
"behat/behat": "^3.16",
16+
"behat/mink-selenium2-driver": "~1.6.0",
17+
"bitbag/coding-standard": "^v2.0",
18+
"dbrekelmans/bdi": "^1.1",
19+
"dmore/behat-chrome-extension": "^1.3",
20+
"dmore/chrome-mink-driver": "^2.7",
21+
"friends-of-behat/mink": "^1.11",
22+
"friends-of-behat/mink-browserkit-driver": "^1.4",
23+
"friends-of-behat/mink-debug-extension": "^2.0.0",
24+
"friends-of-behat/mink-extension": "^2.4",
25+
"friends-of-behat/page-object-extension": "^0.3",
26+
"friends-of-behat/suite-settings-extension": "^1.0",
27+
"friends-of-behat/symfony-extension": "^2.1",
28+
"friends-of-behat/variadic-extension": "^1.3",
29+
"lchrusciel/api-test-case": "^5.2",
30+
"phpspec/phpspec": "^7.2",
31+
"phpstan/extension-installer": "^1.0",
32+
"phpstan/phpstan": "^1.8.1",
33+
"phpstan/phpstan-doctrine": "1.3.69",
34+
"phpstan/phpstan-strict-rules": "^1.3.0",
35+
"phpstan/phpstan-webmozart-assert": "^1.2.0",
36+
"phpunit/phpunit": "^10.5",
37+
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
38+
"robertfausk/behat-panther-extension": "^1.1",
39+
"sylius-labs/coding-standard": "^4.2",
40+
"sylius-labs/suite-tags-extension": "^0.2",
41+
"symfony/browser-kit": "^7.1",
42+
"symfony/debug-bundle": "^7.1",
43+
"symfony/dotenv": "7.1",
44+
"symfony/intl": "^7.1",
45+
"symfony/web-profiler-bundle": "^7.1"
46+
},
47+
"conflict": {
48+
"api-platform/core": "v2.7.17",
49+
"symfony/framework-bundle": "6.2.8"
50+
},
51+
"config": {
52+
"sort-packages": true,
53+
"allow-plugins": {
54+
"composer/package-versions-deprecated": true,
55+
"dealerdirect/phpcodesniffer-composer-installer": true,
56+
"php-http/discovery": false,
57+
"phpstan/extension-installer": true,
58+
"symfony/thanks": true
59+
}
60+
},
61+
"extra": {
62+
"branch-alias": {
63+
"dev-master": "1.13-dev"
7764
},
78-
"autoload-dev": {
79-
"psr-4": {
80-
"Tests\\BitBag\\SyliusElasticsearchPlugin\\Behat\\": "tests/Behat",
81-
"spec\\BitBag\\SyliusElasticsearchPlugin\\": "spec/"
82-
},
83-
"classmap": ["tests/Application/Kernel.php"]
65+
"symfony": {
66+
"require": "^5.4 || ^6.0"
67+
}
68+
},
69+
"autoload": {
70+
"psr-4": {
71+
"BitBag\\SyliusElasticsearchPlugin\\": "src/",
72+
"Tests\\BitBag\\SyliusElasticsearchPlugin\\Application\\": "tests/Application",
73+
"Tests\\BitBag\\SyliusElasticsearchPlugin\\Integration\\": "tests/PHPUnit/Integration"
74+
}
75+
},
76+
"autoload-dev": {
77+
"psr-4": {
78+
"Tests\\BitBag\\SyliusElasticsearchPlugin\\Behat\\": "tests/Behat",
79+
"spec\\BitBag\\SyliusElasticsearchPlugin\\": "spec/"
8480
},
85-
"scripts": {
86-
"post-install-cmd": [
87-
"php bin/create_node_symlink.php"
88-
],
89-
"post-update-cmd": [
90-
"php bin/create_node_symlink.php"
91-
],
92-
"post-create-project-cmd": [
93-
"php bin/create_node_symlink.php"
94-
],
95-
"auto-scripts": {
96-
"cache:clear": "symfony-cmd",
97-
"assets:install %PUBLIC_DIR%": "symfony-cmd",
98-
"security-checker security:check": "script"
99-
}
81+
"classmap": ["tests/Application/Kernel.php"]
82+
},
83+
"scripts": {
84+
"post-install-cmd": [
85+
"php bin/create_node_symlink.php"
86+
],
87+
"post-update-cmd": [
88+
"php bin/create_node_symlink.php"
89+
],
90+
"post-create-project-cmd": [
91+
"php bin/create_node_symlink.php"
92+
],
93+
"auto-scripts": {
94+
"cache:clear": "symfony-cmd",
95+
"assets:install %PUBLIC_DIR%": "symfony-cmd",
96+
"security-checker security:check": "script"
10097
}
98+
}
10199
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<resources xmlns="https://api-platform.com/schema/metadata/resources-3.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0 https://api-platform.com/schema/metadata/resources-3.0.xsd">
6+
<resource class="%sylius.model.product.class%">
7+
<operations>
8+
<operation name="elasticsearch_shop_get"
9+
class="ApiPlatform\Metadata\GetCollection"
10+
uriTemplate="/shop/products/search"
11+
paginationEnabled="false"
12+
provider="bitbag_sylius_elasticsearch_plugin.api.data_provider.product_collection"
13+
openapi="true"
14+
>
15+
<normalizationContext>
16+
<values>
17+
<value name="groups">
18+
<values>
19+
<value>shop:product:index</value>
20+
<value>sylius:shop:product:index</value>
21+
</values>
22+
</value>
23+
</values>
24+
</normalizationContext>
25+
</operation>
26+
</operations>
27+
</resource>
28+
</resources>

src/Resources/config/config.yml config/config.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ imports:
33
- { resource: "indexes/bitbag_option_taxons.yml" }
44
- { resource: "indexes/bitbag_attribute_taxons.yml" }
55
- { resource: "indexes/bitbag_shop_facets.yml" }
6+
- { resource: "twig/bitbag_twig_hooks.yml" }
67

78
parameters:
89
env(BITBAG_ES_INDEX_PREFIX): ""
@@ -28,10 +29,3 @@ fos_elastica:
2829
twig:
2930
globals:
3031
bitbag_es_pagination_available_page_limits: "%bitbag_es_pagination_available_page_limits%"
31-
32-
sylius_ui:
33-
events:
34-
sylius.shop.layout.header.content:
35-
blocks:
36-
bitbag_es_search_form:
37-
template: "@BitBagSyliusElasticsearchPlugin/Shop/Menu/_searchForm.html.twig"

src/Resources/config/routing.yml config/routing.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
bitbag_sylius_elasticsearch_plugin_shop_list_products:
2-
path: /{_locale}/products-list/{slug}
1+
bitbag_sylius_elasticsearch_plugin_shop_taxon_products:
2+
path: /{_locale}/taxons/{slug}
33
defaults:
44
_controller: bitbag_sylius_elasticsearch_plugin.controller.action.shop.taxon_products_search
5-
template: "@BitBagSyliusElasticsearchPlugin/Shop/Product/index.html.twig"
5+
template: "@BitBagSyliusElasticsearchPlugin/Shop/TaxonProductsSearch/index.html.twig"
66
requirements:
77
slug: .+
88

@@ -17,4 +17,4 @@ bitbag_sylius_elasticsearch_plugin_shop_search:
1717
path: /{_locale}/search
1818
defaults:
1919
_controller: bitbag_sylius_elasticsearch_plugin.controller.action.shop.site_wide_products_search
20-
template: "@BitBagSyliusElasticsearchPlugin/Shop/search.html.twig"
20+
template: "@BitBagSyliusElasticsearchPlugin/Shop/SiteWideSearch/index.html.twig"

src/Resources/config/services.xml config/services.xml

+5
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,10 @@
3939
<service id="bitbag.sylius_elasticsearch_plugin.repository.product_option_repository" class="BitBag\SyliusElasticsearchPlugin\Repository\ProductOptionRepository">
4040
<argument type="service" id="sylius.repository.product_option" />
4141
</service>
42+
43+
<service id="BitBag\SyliusElasticsearchPlugin\Api\OpenApi\Documentation\ProductSearchDocumentationModifier"
44+
decorates="api_platform.openapi.factory" public="true">
45+
<argument type="service" id="BitBag\SyliusElasticsearchPlugin\Api\OpenApi\Documentation\ProductSearchDocumentationModifier.inner" />
46+
</service>
4247
</services>
4348
</container>

0 commit comments

Comments
 (0)