Skip to content

Commit 0215a07

Browse files
committed
Merge remote-tracking branch 'origin/2.2.x' into main
2 parents d4a1d39 + b312aaa commit 0215a07

13 files changed

Lines changed: 88 additions & 87 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
declare(strict_types=1);
1414

15-
namespace Gally\SyliusPlugin\Controller;
15+
namespace Gally\SyliusPlugin\Controller\Admin;
1616

1717
use Gally\Sdk\Client\Client;
1818
use Gally\Sdk\Service\StructureSynchonizer;
@@ -29,7 +29,7 @@
2929
use Symfony\Component\HttpFoundation\Response;
3030
use Symfony\Contracts\Translation\TranslatorInterface;
3131

32-
final class AdminGallyController extends AbstractController
32+
final class GallyController extends AbstractController
3333
{
3434
/** @var ProviderInterface[] */
3535
protected array $providers;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
declare(strict_types=1);
1414

15-
namespace Gally\SyliusPlugin\Controller;
15+
namespace Gally\SyliusPlugin\Controller\Shop;
1616

1717
use Gally\Sdk\Entity\Metadata;
1818
use Gally\Sdk\Service\SearchManager;
@@ -30,7 +30,7 @@
3030
use Symfony\Component\HttpFoundation\Request;
3131
use Symfony\Component\HttpFoundation\Response;
3232

33-
final class Filter extends AbstractController
33+
final class FilterController extends AbstractController
3434
{
3535
/**
3636
* @param TaxonRepository<Taxon> $taxonRepository

src/Grid/DataProvider.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121
use Sylius\Component\Grid\Definition\Grid;
2222
use Sylius\Component\Grid\Filtering\FiltersApplicatorInterface;
2323
use Sylius\Component\Grid\Parameters;
24-
use Sylius\Component\Grid\Sorting\SorterInterface;
2524

2625
final class DataProvider implements DataProviderInterface
2726
{
2827
public function __construct(
28+
private DataProviderInterface $dataProvider,
2929
private DataSourceProviderInterface $dataSourceProvider,
3030
private FiltersApplicatorInterface $filtersApplicator,
31-
private SorterInterface $sorter,
3231
private ChannelContextInterface $channelContext,
3332
) {
3433
}
@@ -46,13 +45,6 @@ public function getData(Grid $grid, Parameters $parameters)
4645
}
4746
}
4847

49-
// by default use Sylius' implementation of the data provider
50-
$dataProvider = new \Sylius\Component\Grid\Data\DataProvider(
51-
$this->dataSourceProvider,
52-
$this->filtersApplicator,
53-
$this->sorter,
54-
);
55-
56-
return $dataProvider->getData($grid, $parameters);
48+
return $this->dataProvider->getData($grid, $parameters);
5749
}
5850
}

src/Indexer/AbstractIndexer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ public function reindex(array $documentIdsToReindex = []): void
6363
$bulk = [];
6464
/** @var array $document */
6565
foreach ($this->getDocumentsToIndex($channel, $locale, $documentIdsToReindex) as $document) {
66+
if (0 === \count($document)) {
67+
continue;
68+
}
6669
/** @var array{id: int|string} $document */
6770
$bulk[$document['id']] = json_encode($document);
6871
if (\count($bulk) >= $batchSize) {

src/Indexer/ProductIndexer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ public function getDocumentsToIndex(
9090
private function formatProduct(ProductInterface $product, ChannelInterface $channel, LocaleInterface $locale): array
9191
{
9292
$variants = $product->getVariants();
93-
/** @var ProductVariantInterface $variant */
93+
/** @var ProductVariantInterface|false $variant */
9494
$variant = $variants->first();
95+
if (false === $variant) {
96+
return [];
97+
}
9598

9699
/** @var int|string $productId */
97100
$productId = $product->getId();

src/Resources/config/admin_routing.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
gally_sylius_config:
33
path: /gally/config
44
defaults:
5-
_controller: Gally\SyliusPlugin\Controller\AdminGallyController::renderGallyConfigForm
5+
_controller: Gally\SyliusPlugin\Controller\Admin\GallyController::renderGallyConfigForm
66
name: ~
77

88
gally_sylius_test:
99
path: /gally/test-connection
1010
defaults:
11-
_controller: Gally\SyliusPlugin\Controller\AdminGallyController::renderTestConnectionForm
11+
_controller: Gally\SyliusPlugin\Controller\Admin\GallyController::renderTestConnectionForm
1212
name: ~
1313

1414
gally_sylius_sync:
1515
path: /gally/sync-fields
1616
defaults:
17-
_controller: Gally\SyliusPlugin\Controller\AdminGallyController::renderSyncFieldsForm
17+
_controller: Gally\SyliusPlugin\Controller\Admin\GallyController::renderSyncFieldsForm
1818
name: ~
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
sylius_twig_hooks:
2+
hooks:
3+
'gally_admin.gally.index':
4+
sidebar:
5+
template: '@SyliusAdmin/shared/crud/common/sidebar.html.twig'
6+
priority: 200
7+
navbar:
8+
template: '@SyliusAdmin/shared/crud/common/navbar.html.twig'
9+
priority: 100
10+
content:
11+
template: '@SyliusAdmin/shared/crud/common/content.html.twig'
12+
priority: 0
13+
14+
'gally_admin.gally.index.content':
15+
header:
16+
template: '@SyliusAdmin/shared/crud/common/content/header.html.twig'
17+
priority: 200
18+
grid:
19+
enabled: false
20+
configuration:
21+
template: '@GallySyliusPlugin/admin/gally/index/configuration.html.twig'
22+
priority: 100
23+
24+
'gally_admin.gally.index.content.configuration':
25+
connection:
26+
template: '@GallySyliusPlugin/admin/gally/index/configuration/connection.html.twig'
27+
priority: 30
28+
test_connection:
29+
template: '@GallySyliusPlugin/admin/gally/index/configuration/test_connection.html.twig'
30+
priority: 20
31+
sync_source_fields:
32+
template: '@GallySyliusPlugin/admin/gally/index/configuration/sync_source_fields.html.twig'
33+
priority: 10
34+
35+
'gally_admin.gally.index.content.header':
36+
breadcrumbs:
37+
enabled: false
38+
title_block:
39+
template: '@SyliusAdmin/shared/crud/common/content/header/title_block.html.twig'
40+
priority: 0
41+
42+
'gally_admin.gally.index.content.header.title_block':
43+
title:
44+
template: '@SyliusAdmin/shared/crud/common/content/header/title_block/title.html.twig'
45+
configuration:
46+
title: Gally
47+
sylius_test_html_attribute: 'gally-config-header'
48+
priority: 100
49+
actions:
50+
enabled: false
51+
52+
'sylius_admin.channel.create.content.form.sections':
53+
gally:
54+
template: '@GallySyliusPlugin/admin/channel/form/sections/gally.html.twig'
55+
priority: 0
56+
57+
'sylius_admin.channel.update.content.form.sections':
58+
gally:
59+
template: '@GallySyliusPlugin/admin/channel/form/sections/gally.html.twig'
60+
priority: 0

src/Resources/config/app/twig_hooks.yml renamed to src/Resources/config/app/twig_hooks_shop.yml

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -45,66 +45,6 @@ sylius_twig_hooks:
4545
gally_filters:
4646
template: '@GallySyliusPlugin/shop/product/search/content/body/sidebar/filters.html.twig'
4747

48-
49-
'gally_admin.gally.index':
50-
sidebar:
51-
template: '@SyliusAdmin/shared/crud/common/sidebar.html.twig'
52-
priority: 200
53-
navbar:
54-
template: '@SyliusAdmin/shared/crud/common/navbar.html.twig'
55-
priority: 100
56-
content:
57-
template: '@SyliusAdmin/shared/crud/common/content.html.twig'
58-
priority: 0
59-
60-
'gally_admin.gally.index.content':
61-
header:
62-
template: '@SyliusAdmin/shared/crud/common/content/header.html.twig'
63-
priority: 200
64-
grid:
65-
enabled: false
66-
configuration:
67-
template: '@GallySyliusPlugin/admin/gally/index/configuration.html.twig'
68-
priority: 100
69-
70-
'gally_admin.gally.index.content.configuration':
71-
connection:
72-
template: '@GallySyliusPlugin/admin/gally/index/configuration/connection.html.twig'
73-
priority: 30
74-
test_connection:
75-
template: '@GallySyliusPlugin/admin/gally/index/configuration/test_connection.html.twig'
76-
priority: 20
77-
sync_source_fields:
78-
template: '@GallySyliusPlugin/admin/gally/index/configuration/sync_source_fields.html.twig'
79-
priority: 10
80-
81-
'gally_admin.gally.index.content.header':
82-
breadcrumbs:
83-
enabled: false
84-
title_block:
85-
template: '@SyliusAdmin/shared/crud/common/content/header/title_block.html.twig'
86-
priority: 0
87-
88-
'gally_admin.gally.index.content.header.title_block':
89-
title:
90-
template: '@SyliusAdmin/shared/crud/common/content/header/title_block/title.html.twig'
91-
configuration:
92-
title: Gally
93-
sylius_test_html_attribute: 'gally-config-header'
94-
priority: 100
95-
actions:
96-
enabled: false
97-
98-
'sylius_admin.channel.create.content.form.sections':
99-
gally:
100-
template: '@GallySyliusPlugin/admin/channel/form/sections/gally.html.twig'
101-
priority: 0
102-
103-
'sylius_admin.channel.update.content.form.sections':
104-
gally:
105-
template: '@GallySyliusPlugin/admin/channel/form/sections/gally.html.twig'
106-
priority: 0
107-
10848
'sylius_shop.base#stylesheets':
10949
gally:
11050
template: "@GallySyliusPlugin/shop/events_stylesheets.html.twig"

src/Resources/config/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
imports:
2-
- { resource: "app/twig_hooks.yml" }
3-
- { resource: "app/grid.yml" }
42
- { resource: "app/filters.yml" }
3+
- { resource: "app/grid.yml" }
4+
- { resource: "app/twig_hooks_admin.yml" }
5+
- { resource: "app/twig_hooks_shop.yml" }

src/Resources/config/services.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</argument>
2727
</service>
2828

29-
<service id="Gally\SyliusPlugin\Controller\AdminGallyController">
29+
<service id="Gally\SyliusPlugin\Controller\Admin\GallyController">
3030
<argument type="service" id="Gally\SyliusPlugin\Repository\GallyConfigurationRepository" />
3131
<argument type="service" id="Gally\Sdk\Service\StructureSynchonizer" />
3232
<argument type="service" id="Gally\SyliusPlugin\Config\ConfigManager" />
@@ -39,7 +39,7 @@
3939
<tag name="controller.service_arguments" />
4040
</service>
4141

42-
<service id="Gally\SyliusPlugin\Controller\Filter">
42+
<service id="Gally\SyliusPlugin\Controller\Shop\FilterController">
4343
<argument type="service" id="Gally\SyliusPlugin\Indexer\Provider\CatalogProvider" />
4444
<argument type="service" id="Gally\Sdk\Service\SearchManager" />
4545
<argument type="service" id="sylius.context.channel" />

0 commit comments

Comments
 (0)