File tree Expand file tree Collapse file tree 6 files changed +23
-40
lines changed Expand file tree Collapse file tree 6 files changed +23
-40
lines changed Original file line number Diff line number Diff line change 11
11
12
12
class AdditionalSectionHelper extends AbstractEntityHelper
13
13
{
14
+ use EntityHelperTrait;
15
+ public const INDEX_NAME_SUFFIX = '_section ' ;
16
+
14
17
public function __construct (
15
18
protected ManagerInterface $ eventManager ,
16
19
protected CollectionFactory $ collectionFactory ,
@@ -21,14 +24,6 @@ public function __construct(
21
24
parent ::__construct ($ indexNameFetcher );
22
25
}
23
26
24
- /**
25
- * @inheritDoc
26
- */
27
- public function getIndexNameSuffix (): string
28
- {
29
- return '_section ' ;
30
- }
31
-
32
27
public function getIndexSettings ($ storeId ): array
33
28
{
34
29
$ indexSettings = [
Original file line number Diff line number Diff line change 24
24
25
25
class CategoryHelper extends AbstractEntityHelper
26
26
{
27
+ use EntityHelperTrait;
28
+ public const INDEX_NAME_SUFFIX = '_categories ' ;
27
29
protected $ isCategoryVisibleInMenuCache ;
28
30
protected $ coreCategories ;
29
31
protected $ idColumn ;
@@ -48,14 +50,6 @@ public function __construct(
48
50
parent ::__construct ($ indexNameFetcher );
49
51
}
50
52
51
- /**
52
- * @inheritDoc
53
- */
54
- public function getIndexNameSuffix (): string
55
- {
56
- return '_categories ' ;
57
- }
58
-
59
53
/**
60
54
* @param $storeId
61
55
* @return array|mixed|null
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Algolia \AlgoliaSearch \Helper \Entity ;
4
+
5
+ trait EntityHelperTrait
6
+ {
7
+ public function getIndexNameSuffix (): string
8
+ {
9
+ return self ::INDEX_NAME_SUFFIX ;
10
+ }
11
+ }
Original file line number Diff line number Diff line change 15
15
16
16
class PageHelper extends AbstractEntityHelper
17
17
{
18
+ use EntityHelperTrait;
19
+ public const INDEX_NAME_SUFFIX = '_pages ' ;
20
+
18
21
public function __construct (
19
22
protected ManagerInterface $ eventManager ,
20
23
protected PageCollectionFactory $ pageCollectionFactory ,
@@ -28,14 +31,6 @@ public function __construct(
28
31
parent ::__construct ($ indexNameFetcher );
29
32
}
30
33
31
- /**
32
- * @inheritDoc
33
- */
34
- public function getIndexNameSuffix (): string
35
- {
36
- return '_pages ' ;
37
- }
38
-
39
34
public function getIndexSettings ($ storeId )
40
35
{
41
36
$ indexSettings = [
Original file line number Diff line number Diff line change 41
41
42
42
class ProductHelper extends AbstractEntityHelper
43
43
{
44
+ use EntityHelperTrait;
44
45
public const INDEX_NAME_SUFFIX = '_products ' ;
45
46
/**
46
47
* @var AbstractType[]
@@ -113,14 +114,6 @@ public function __construct(
113
114
parent ::__construct ($ indexNameFetcher );
114
115
}
115
116
116
- /**
117
- * @inheritDoc
118
- */
119
- public function getIndexNameSuffix (): string
120
- {
121
- return self ::INDEX_NAME_SUFFIX ;
122
- }
123
-
124
117
/**
125
118
* @param bool $addEmptyRow
126
119
* @return array
Original file line number Diff line number Diff line change 15
15
16
16
class SuggestionHelper extends AbstractEntityHelper
17
17
{
18
+ use EntityHelperTrait;
19
+ public const INDEX_NAME_SUFFIX = '_suggestions ' ;
20
+
18
21
/**
19
22
* @var string
20
23
*/
@@ -32,14 +35,6 @@ public function __construct(
32
35
parent ::__construct ($ indexNameFetcher );
33
36
}
34
37
35
- /**
36
- * @inheritDoc
37
- */
38
- public function getIndexNameSuffix (): string
39
- {
40
- return '_suggestions ' ;
41
- }
42
-
43
38
/**
44
39
* @param $storeId
45
40
* @return array|mixed|null
You can’t perform that action at this time.
0 commit comments