Skip to content

Commit 7894209

Browse files
Upgrade to 2.0
1 parent dca1463 commit 7894209

Some content is hidden

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

55 files changed

+2111
-690
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
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 \

assets/shop/entrypoint.js

Whitespace-only changes.

composer.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,46 @@
44
"description": "BitBag Elasticsearch plugin for Sylius.",
55
"license": "MIT",
66
"require": {
7-
"php": "^8.1",
7+
"php": "^8.2",
88
"ext-json": "*",
99
"friendsofsymfony/elastica-bundle": "^6.0",
10-
"sylius/sylius": "~1.13.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"
10+
"sylius/sylius": "~2.0.0",
11+
"symfony/property-access": "^6.4 || ^7.1",
12+
"symfony/webpack-encore-bundle": "^2.2",
13+
"symfony/proxy-manager-bridge": "^6.4 || ^7.1"
1414
},
1515
"require-dev": {
16-
"behat/behat": "^3.6.1",
16+
"behat/behat": "^3.16",
1717
"behat/mink-selenium2-driver": "^1.4",
1818
"bitbag/coding-standard": "^v2.0",
1919
"dbrekelmans/bdi": "^1.1",
2020
"dmore/behat-chrome-extension": "^1.3",
2121
"dmore/chrome-mink-driver": "^2.7",
22-
"friends-of-behat/mink": "^1.8",
22+
"friends-of-behat/mink": "^1.11",
2323
"friends-of-behat/mink-browserkit-driver": "^1.4",
2424
"friends-of-behat/mink-debug-extension": "^2.0.0",
2525
"friends-of-behat/mink-extension": "^2.4",
2626
"friends-of-behat/page-object-extension": "^0.3",
2727
"friends-of-behat/suite-settings-extension": "^1.0",
2828
"friends-of-behat/symfony-extension": "^2.1",
2929
"friends-of-behat/variadic-extension": "^1.3",
30-
"league/flysystem-bundle": "2.4.0",
3130
"lchrusciel/api-test-case": "^5.2",
3231
"phpspec/phpspec": "^7.2",
3332
"phpstan/extension-installer": "^1.0",
3433
"phpstan/phpstan": "^1.8.1",
3534
"phpstan/phpstan-doctrine": "1.3.69",
3635
"phpstan/phpstan-strict-rules": "^1.3.0",
3736
"phpstan/phpstan-webmozart-assert": "^1.2.0",
38-
"phpunit/phpunit": "^9.0 || ^10.0",
37+
"phpunit/phpunit": "^10.5",
3938
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
4039
"robertfausk/behat-panther-extension": "^1.1",
4140
"sylius-labs/coding-standard": "^4.2",
4241
"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"
42+
"symfony/browser-kit": "^6.4 || ^7.1",
43+
"symfony/debug-bundle": "^6.4 || ^7.1",
44+
"symfony/dotenv": "^6.4 || ^7.1",
45+
"symfony/intl": "^6.4 || ^7.1",
46+
"symfony/web-profiler-bundle": "^6.4 || ^7.1"
4847
},
4948
"conflict": {
5049
"api-platform/core": "v2.7.17",
@@ -54,10 +53,11 @@
5453
"config": {
5554
"sort-packages": true,
5655
"allow-plugins": {
57-
"symfony/thanks": true,
5856
"composer/package-versions-deprecated": true,
5957
"dealerdirect/phpcodesniffer-composer-installer": true,
60-
"phpstan/extension-installer": true
58+
"php-http/discovery": false,
59+
"phpstan/extension-installer": true,
60+
"symfony/thanks": true
6161
}
6262
},
6363
"extra": {

src/Controller/Action/Shop/SiteWideProductsSearchAction.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ public function __invoke(Request $request): Response
3030
/** @var Search $search */
3131
$search = $form->getData();
3232

33-
/** @var SearchBox $searchBox */
34-
$searchBox = $search->getBox();
35-
3633
$data = array_merge(
37-
['query' => $searchBox->getQuery()],
34+
['query' => $search->getQuery()],
3835
['facets' => $search->getFacets()],
3936
$this->dataHandler->retrieveData($request->query->all()),
4037
);
@@ -49,8 +46,9 @@ public function __invoke(Request $request): Response
4946
return new Response($this->twig->render(
5047
$template,
5148
[
52-
'results' => $results ?? null,
53-
'searchForm' => $form->createView(),
49+
'products' => $results ?? null,
50+
'resources' => $results ?? null,
51+
'search_form' => $form->createView(),
5452
]
5553
));
5654
}

src/Form/EventSubscriber/AddFacetsEventSubscriber.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,12 @@ private function modifyForm(FormInterface $form, AdapterInterface $adapter): voi
5252
return;
5353
}
5454

55-
$form->add(
56-
'facets',
57-
SearchFacetsType::class,
58-
[
55+
$form
56+
->add('facets', SearchFacetsType::class, [
5957
'facets' => $adapter->getAggregations(),
6058
'label' => false,
61-
]
62-
);
59+
'required' => false,
60+
])
61+
;
6362
}
6463
}

src/Form/Type/SearchType.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use BitBag\SyliusElasticsearchPlugin\Form\Resolver\ProductsFilterFacetResolverInterface;
1818
use BitBag\SyliusElasticsearchPlugin\Model\Search;
1919
use Symfony\Component\Form\AbstractType;
20+
use Symfony\Component\Form\Extension\Core\Type\TextType;
2021
use Symfony\Component\Form\FormBuilderInterface;
2122
use Symfony\Component\OptionsResolver\OptionsResolver;
2223

@@ -31,7 +32,14 @@ public function __construct(
3132
public function buildForm(FormBuilderInterface $builder, array $options): void
3233
{
3334
$builder
34-
->add('box', SearchBoxType::class, ['label' => false])
35+
->add('query', TextType::class, [
36+
'label' => false,
37+
'required' => false,
38+
'attr' => [
39+
'placeholder' => 'bitbag_sylius_elasticsearch_plugin.ui.search_box.query.placeholder',
40+
'class' => 'prompt app-quick-add-code-input',
41+
],
42+
])
3543
->setMethod('GET')
3644
;
3745

src/Model/Search.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,20 @@
1212

1313
namespace BitBag\SyliusElasticsearchPlugin\Model;
1414

15-
class Search
15+
final class Search
1616
{
17-
private ?SearchBox $box;
17+
private ?string $query = null;
1818

1919
private array $facets = [];
2020

21-
public function __construct()
21+
public function getQuery(): ?string
2222
{
23-
$this->box = new SearchBox();
23+
return $this->query;
2424
}
2525

26-
public function getBox(): ?SearchBox
26+
public function setQuery(?string $query): void
2727
{
28-
return $this->box;
29-
}
30-
31-
public function setBox(?SearchBox $box): void
32-
{
33-
$this->box = $box;
28+
$this->query = $query;
3429
}
3530

3631
public function getFacets(): array

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

Lines changed: 0 additions & 1 deletion
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;

0 commit comments

Comments
 (0)