-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from tuyennn/feature/issue15-query-shard-excep…
…tion Feature/issue15 query shard exception
- Loading branch information
Showing
4 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace GhoSter\OutOfStockAtLast\Plugin\Model\Adapter; | ||
|
||
/** | ||
* phpcs:ignore Magento2.Legacy.Copyright.FoundCopyrightMissingOrWrongFormat | ||
* Class AdditionalFieldMapperPlugin for es attributes mapping | ||
*/ | ||
class AdditionalFieldMapperPlugin | ||
{ | ||
/** | ||
* @var string[] | ||
*/ | ||
protected $allowedFields = [ | ||
'out_of_stock_at_last' => 'integer' | ||
]; | ||
|
||
/** | ||
* Missing mapped attribute code | ||
* | ||
* @param mixed $subject | ||
* @param array $result | ||
* @return array | ||
*/ | ||
public function afterGetAllAttributesTypes($subject, array $result): array | ||
{ | ||
foreach ($this->allowedFields as $fieldName => $fieldType) { | ||
$result[$fieldName] = ['type' => $fieldType]; | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
/** | ||
* 3rd module Compatibility | ||
* | ||
* @param mixed $subject | ||
* @param array $result | ||
* @return array | ||
*/ | ||
public function afterBuildEntityFields($subject, array $result): array | ||
{ | ||
return $this->afterGetAllAttributesTypes($subject, $result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters