Skip to content

Commit ca66f75

Browse files
authored
Merge pull request #33 from dachcom-digital/type_selection
move index types out of compiler pass
2 parents 6987916 + e707b89 commit ca66f75

File tree

5 files changed

+41
-30
lines changed

5 files changed

+41
-30
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,23 @@ dynamic_search:
7373
7474
### always
7575
76-
| Name | Default Value | Description |
77-
|:-----------------------------------|:--------------------------------------|:------------|
78-
| `index_asset` | false | |
79-
| `asset_data_builder_identifier` | true | |
80-
| `asset_types` | `Asset::$types[]`, except folder | |
81-
| `asset_additional_params` | [] | |
82-
| | | |
83-
| `index_object` | false | |
84-
| `object_data_builder_identifier` | 'default' | |
85-
| `object_types` | `DataObject::$types[]`, except folder | |
86-
| `object_class_names` | [] | |
87-
| `object_additional_params` | [] | |
88-
| | | |
89-
| `index_document` | false | |
90-
| `document_data_builder_identifier` | 'default' | |
91-
| `document_types` | `Document::$types`, except folder | |
92-
| `document_additional_params` | [] | |
76+
| Name | Default Value | Description |
77+
|:-----------------------------------|:----------------------------------------|:------------|
78+
| `index_asset` | false | |
79+
| `asset_data_builder_identifier` | true | |
80+
| `asset_types` | `Asset::getTypes()`, except folder | |
81+
| `asset_additional_params` | [] | |
82+
| | | |
83+
| `index_object` | false | |
84+
| `object_data_builder_identifier` | 'default' | |
85+
| `object_types` | `DataObject::getTypes()`, except folder | |
86+
| `object_class_names` | [] | |
87+
| `object_additional_params` | [] | |
88+
| | | |
89+
| `index_document` | false | |
90+
| `document_data_builder_identifier` | 'default' | |
91+
| `document_types` | `Document::getTypes()`, except folder | |
92+
| `document_additional_params` | [] | |
9393

9494
### full_dispatch
9595

src/Provider/TrinityDataProvider.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,18 @@ public static function configureOptions(OptionsResolver $resolver): void
3232
'index_asset' => false,
3333
'asset_data_builder_identifier' => 'default',
3434
'asset_additional_params' => [],
35-
'asset_types' => array_filter(Asset::getTypes(), static function ($type) {
36-
return $type !== 'folder';
37-
}),
35+
'asset_types' => null,
3836
// objects
3937
'index_object' => false,
4038
'object_data_builder_identifier' => 'default',
4139
'object_class_names' => [],
4240
'object_additional_params' => [],
43-
'object_types' => array_filter(DataObject::getTypes(), static function ($type) {
44-
return $type !== 'folder';
45-
}),
41+
'object_types' => null,
4642
// documents
4743
'index_document' => false,
4844
'document_data_builder_identifier' => 'default',
4945
'document_additional_params' => [],
50-
'document_types' => array_filter(Document::getTypes(), static function ($type) {
51-
return $type !== 'folder';
52-
})
46+
'document_types' => null
5347
];
5448

5549
$spoolResolver->setDefaults($options);
@@ -138,5 +132,4 @@ protected function setupDataProvider(ContextDefinitionInterface $contextDefiniti
138132
$this->dataProvider->setContextDispatchType($contextDefinition->getContextDispatchType());
139133
$this->dataProvider->setIndexOptions($this->options);
140134
}
141-
142135
}

src/Service/Builder/AssetListBuilder.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,14 @@ protected function getList(array $options): Asset\Listing
7373
return $list;
7474
}
7575

76-
protected function addAssetTypeRestriction(Asset\Listing $listing, array $allowedTypes): Asset\Listing
76+
protected function addAssetTypeRestriction(Asset\Listing $listing, ?array $allowedTypes): Asset\Listing
7777
{
78+
if ($allowedTypes === null) {
79+
$allowedTypes = array_filter(Asset::getTypes(), static function ($type) {
80+
return $type !== 'folder';
81+
});
82+
}
83+
7884
if (count($allowedTypes) === 0) {
7985
return $listing;
8086
}

src/Service/Builder/DocumentListBuilder.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,14 @@ protected function getList(array $options): Document\Listing
7575
return $list;
7676
}
7777

78-
protected function addDocumentTypeRestriction(Document\Listing $listing, array $allowedTypes): Document\Listing
78+
protected function addDocumentTypeRestriction(Document\Listing $listing, ?array $allowedTypes): Document\Listing
7979
{
80+
if ($allowedTypes === null) {
81+
$allowedTypes = array_filter(Document::getTypes(), static function ($type) {
82+
return $type !== 'folder';
83+
});
84+
}
85+
8086
if (count($allowedTypes) === 0) {
8187
return $listing;
8288
}

src/Service/Builder/ObjectListBuilder.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,14 @@ protected function getList(array $options): DataObject\Listing
7676
return $event->getListing();
7777
}
7878

79-
protected function addObjectTypeRestriction(DataObject\Listing $listing, array $allowedTypes): DataObject\Listing
79+
protected function addObjectTypeRestriction(DataObject\Listing $listing, ?array $allowedTypes): DataObject\Listing
8080
{
81+
if ($allowedTypes === null) {
82+
$allowedTypes = array_filter(DataObject::getTypes(), static function ($type) {
83+
return $type !== 'folder';
84+
});
85+
}
86+
8187
if (count($allowedTypes) === 0) {
8288
return $listing;
8389
}

0 commit comments

Comments
 (0)