Skip to content

Commit

Permalink
move index types out of compiler pass
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Sep 22, 2023
1 parent 6987916 commit e707b89
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 30 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,23 @@ dynamic_search:
### always
| Name | Default Value | Description |
|:-----------------------------------|:--------------------------------------|:------------|
| `index_asset` | false | |
| `asset_data_builder_identifier` | true | |
| `asset_types` | `Asset::$types[]`, except folder | |
| `asset_additional_params` | [] | |
| | | |
| `index_object` | false | |
| `object_data_builder_identifier` | 'default' | |
| `object_types` | `DataObject::$types[]`, except folder | |
| `object_class_names` | [] | |
| `object_additional_params` | [] | |
| | | |
| `index_document` | false | |
| `document_data_builder_identifier` | 'default' | |
| `document_types` | `Document::$types`, except folder | |
| `document_additional_params` | [] | |
| Name | Default Value | Description |
|:-----------------------------------|:----------------------------------------|:------------|
| `index_asset` | false | |
| `asset_data_builder_identifier` | true | |
| `asset_types` | `Asset::getTypes()`, except folder | |
| `asset_additional_params` | [] | |
| | | |
| `index_object` | false | |
| `object_data_builder_identifier` | 'default' | |
| `object_types` | `DataObject::getTypes()`, except folder | |
| `object_class_names` | [] | |
| `object_additional_params` | [] | |
| | | |
| `index_document` | false | |
| `document_data_builder_identifier` | 'default' | |
| `document_types` | `Document::getTypes()`, except folder | |
| `document_additional_params` | [] | |

### full_dispatch

Expand Down
13 changes: 3 additions & 10 deletions src/Provider/TrinityDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,18 @@ public static function configureOptions(OptionsResolver $resolver): void
'index_asset' => false,
'asset_data_builder_identifier' => 'default',
'asset_additional_params' => [],
'asset_types' => array_filter(Asset::getTypes(), static function ($type) {
return $type !== 'folder';
}),
'asset_types' => null,
// objects
'index_object' => false,
'object_data_builder_identifier' => 'default',
'object_class_names' => [],
'object_additional_params' => [],
'object_types' => array_filter(DataObject::getTypes(), static function ($type) {
return $type !== 'folder';
}),
'object_types' => null,
// documents
'index_document' => false,
'document_data_builder_identifier' => 'default',
'document_additional_params' => [],
'document_types' => array_filter(Document::getTypes(), static function ($type) {
return $type !== 'folder';
})
'document_types' => null
];

$spoolResolver->setDefaults($options);
Expand Down Expand Up @@ -138,5 +132,4 @@ protected function setupDataProvider(ContextDefinitionInterface $contextDefiniti
$this->dataProvider->setContextDispatchType($contextDefinition->getContextDispatchType());
$this->dataProvider->setIndexOptions($this->options);
}

}
8 changes: 7 additions & 1 deletion src/Service/Builder/AssetListBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ protected function getList(array $options): Asset\Listing
return $list;
}

protected function addAssetTypeRestriction(Asset\Listing $listing, array $allowedTypes): Asset\Listing
protected function addAssetTypeRestriction(Asset\Listing $listing, ?array $allowedTypes): Asset\Listing
{
if ($allowedTypes === null) {
$allowedTypes = array_filter(Asset::getTypes(), static function ($type) {
return $type !== 'folder';
});
}

if (count($allowedTypes) === 0) {
return $listing;
}
Expand Down
8 changes: 7 additions & 1 deletion src/Service/Builder/DocumentListBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,14 @@ protected function getList(array $options): Document\Listing
return $list;
}

protected function addDocumentTypeRestriction(Document\Listing $listing, array $allowedTypes): Document\Listing
protected function addDocumentTypeRestriction(Document\Listing $listing, ?array $allowedTypes): Document\Listing
{
if ($allowedTypes === null) {
$allowedTypes = array_filter(Document::getTypes(), static function ($type) {
return $type !== 'folder';
});
}

if (count($allowedTypes) === 0) {
return $listing;
}
Expand Down
8 changes: 7 additions & 1 deletion src/Service/Builder/ObjectListBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,14 @@ protected function getList(array $options): DataObject\Listing
return $event->getListing();
}

protected function addObjectTypeRestriction(DataObject\Listing $listing, array $allowedTypes): DataObject\Listing
protected function addObjectTypeRestriction(DataObject\Listing $listing, ?array $allowedTypes): DataObject\Listing
{
if ($allowedTypes === null) {
$allowedTypes = array_filter(DataObject::getTypes(), static function ($type) {
return $type !== 'folder';
});
}

if (count($allowedTypes) === 0) {
return $listing;
}
Expand Down

0 comments on commit e707b89

Please sign in to comment.