Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add class_alias for asset field definition adapters #267

Merged
merged 8 commits into from
Dec 5, 2024
12 changes: 12 additions & 0 deletions src/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,17 @@
use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Traits\QueryObjectsToArrayTrait as OpenSearchQueryObjectsToArrayTrait;
use Pimcore\Bundle\GenericDataIndexBundle\Model\OpenSearch\Traits\SimplifySingleTypesTrait as OpenSearchSimplifySingleTypesTrait;
use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\AbstractAdapter as AssetAbstractAdapter;
use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\BooleanAdapter;
use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\DateAdapter;
use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\KeywordAdapter;
use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\RelationAdapter;
use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\Asset\FieldDefinitionAdapter\TextKeywordAdapter;
use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\DefaultSearch\DataObject\FieldDefinitionAdapter\AbstractAdapter as DataObjectAbstractAdapter;
use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\Asset\FieldDefinitionAdapter\AbstractAdapter as OpenSearchAssetAbstractAdapter;
use Pimcore\Bundle\GenericDataIndexBundle\SearchIndexAdapter\OpenSearch\DataObject\FieldDefinitionAdapter\AbstractAdapter as OpenSearchDataObjectAbstractAdapter;

const ASSET_FIELD_DEFINITION_ADAPTER_NAMESPACE = 'Pimcore\\Bundle\GenericDataIndexBundle\\SearchIndexAdapter\\OpenSearch\\Asset\\FieldDefinitionAdapter\\';

$classesToAlias = [
AttributeType::class => OpenSearchAttributeType::class,
ConditionType::class => OpenSearchConditionType::class,
Expand Down Expand Up @@ -101,6 +108,11 @@
DefaultSearchInterface::class => OpenSearchSearchInterface::class,
AssetAbstractAdapter::class => OpenSearchAssetAbstractAdapter::class,
DataObjectAbstractAdapter::class => OpenSearchDataObjectAbstractAdapter::class,
BooleanAdapter::class => ASSET_FIELD_DEFINITION_ADAPTER_NAMESPACE . 'BooleanAdapter',
DateAdapter::class => ASSET_FIELD_DEFINITION_ADAPTER_NAMESPACE . 'DateAdapter',
KeywordAdapter::class => ASSET_FIELD_DEFINITION_ADAPTER_NAMESPACE . 'KeywordAdapter',
RelationAdapter::class => ASSET_FIELD_DEFINITION_ADAPTER_NAMESPACE . 'RelationAdapter',
TextKeywordAdapter::class => ASSET_FIELD_DEFINITION_ADAPTER_NAMESPACE . 'TextKeywordAdapter',
];

foreach ($classesToAlias as $originalClass => $aliasClass) {
Expand Down
Loading