ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,48 @@
<?php
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Elastic Search Base for Magento 2
*/
namespace Amasty\ElasticSearch\Ui\RelevanceRule\Form;
use Amasty\ElasticSearch\Api\Data\RelevanceRuleInterface;
use Amasty\ElasticSearch\Model\Source\RelevanceRuleModificationType;
use Magento\Ui\DataProvider\AbstractDataProvider;
class DataProvider extends AbstractDataProvider
{
public function __construct(
\Amasty\ElasticSearch\Model\ResourceModel\RelevanceRule\CollectionFactory $collectionFactory,
$name,
$primaryFieldName,
$requestFieldName,
array $meta = [],
array $data = []
) {
parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
$this->collection = $collectionFactory->create();
}
/**
* @inheritdoc
*/
public function getData()
{
$result = [];
/** @var RelevanceRuleInterface $item */
foreach ($this->collection as $item) {
$result[$item->getId()] = $item->getData();
if ($item->getMultiplier() < 0) {
$result[$item->getId()][RelevanceRuleInterface::MULTIPLIER] = abs($item->getMultiplier());
$result[$item->getId()]['modification_type'] = RelevanceRuleModificationType::DECREASE;
} else {
$result[$item->getId()]['modification_type'] = RelevanceRuleModificationType::INCREASE;
}
}
return $result;
}
}