Skip to content

Commit

Permalink
Merge branch '2.10.x' into 2.11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
rbayet committed Oct 4, 2023
2 parents fbb54fc + f64de6f commit 7ed87e2
Show file tree
Hide file tree
Showing 29 changed files with 119 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function execute()
$responseData = $this->getPreviewObject()->getData();
$json = $this->jsonHelper->jsonEncode($responseData);

$this->getResponse()->representJson($json);
return $this->getResponse()->representJson($json);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function beforeSave()
{
$this->parseDateFields();

parent::beforeSave();
return parent::beforeSave();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public function addField($field, $alias = null)

/**
* {@inheritdoc}
*
* @return void
*/
public function addFilter(\Magento\Framework\Api\Filter $filter)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public function execute()
$model->setData('url_params', $this->getRequest()->getParams());
$result = $model->asHtmlRecursive();
}
$this->getResponse()->setBody($result);

return $this->getResponse()->setBody($result);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function execute()
}

$json = $this->jsonHelper->jsonEncode($responseData);
$this->getResponse()->representJson($json);

return $this->getResponse()->representJson($json);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function __construct(
* @param array $newProductPositions Product positions.
* @param array $blacklistedProducts Blacklisted product ids.
*
* @return \Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Search\Position
* @return void
*/
public function saveProductPositions($queryId, $newProductPositions, $blacklistedProducts = [])
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ protected function _beforeLoad()
if ($this->category && $this->category->getId()) {
$this->applyCategory();
}

return $this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ function (\Magento\Framework\Api\Search\Document $doc) {

$this->isSpellchecked = $searchRequest->isSpellchecked();

return parent::_renderFiltersBefore();
parent::_renderFiltersBefore();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public function addField($field, $alias = null)

/**
* {@inheritdoc}
*
* @return void
*/
public function addFilter(\Magento\Framework\Api\Filter $filter)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function createIndex($indexIdentifier, $store);
* @param integer|string|\Magento\Store\Api\Data\StoreInterface $store Store (id, identifier or object).
* @param array $fields The fields to update. Default to all.
*
* @return \Smile\ElasticsuiteCore\Api\Index\IndexInterface
* @return void
*/
public function updateMapping($indexIdentifier, $store, $fields = []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,16 @@ public function getCurrentSelectionName()
*/
public function getCurrentStoreName()
{
$storeName = '';
if ($this->getStoreId() !== null) {
$store = $this->storeFactory->create();
$store->load($this->getStoreId());
if ($store->getId()) {
return $store->getName();
$storeName = $store->getName();
}
}

return $storeName;
}

/**
Expand All @@ -300,13 +303,16 @@ public function getCurrentStoreName()
*/
public function getCurrentContainerName()
{
$containerName = '';
if ($this->getContainerCode() !== null) {
$container = $this->containersSource->get($this->getContainerCode());

if ($this->getContainerName($container)) {
return $this->getContainerName($container);
$containerName = $this->getContainerName($container);
}
}

return $containerName;
}

/**
Expand All @@ -328,13 +334,16 @@ public function getContainerName($container)
*/
public function getCurrentContainerLabel()
{
$containerLabel = '';
if ($this->getContainerCode() !== null) {
$container = $this->containersSource->get($this->getContainerCode());

if ($this->getContainerLabel($container)) {
return $this->getContainerLabel($container);
$containerLabel = $this->getContainerLabel($container);
}
}

return $containerLabel;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/module-elasticsuite-core/Index/AsyncIndexOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public function __construct(

/**
* {@inheritDoc}
*
* @return void
*/
public function executeBulk(\Smile\ElasticsuiteCore\Api\Index\Bulk\BulkRequestInterface $bulk)
{
Expand Down
1 change: 1 addition & 0 deletions src/module-elasticsuite-core/Index/Mapping/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public function mergeConfig(array $config = [])
{
$config = array_merge($this->config, $config);

// @phpstan-ignore-next-line
return new static($this->name, $config['type'] ?? $this->type, $this->nestedPath, $config);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ private function addFilters()
$this->_data[$requestName]['filters'] = $filters;
}
}

return $this;
}

/**
Expand All @@ -125,6 +127,8 @@ private function addAggregationProviders()
$this->_data[$requestName]['aggregationsProviders'] = $providers;
}
}

return $this;
}

/**
Expand All @@ -145,6 +149,8 @@ private function addAggregationFilters()
$this->_data[$requestName]['aggregations'] = $aggregations;
}
}

return $this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private function getObjectManagerMock()
/**
* Client factory mocking.
*
* @return \PHPUnit\Framework\MockObject\MockObject
* @return void
*/
private function initClientMock()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Magento\Backend\Block\Template;
use Smile\ElasticsuiteIndices\Block\Widget\Grid\Column\Renderer\IndexStatus;
use Smile\ElasticsuiteIndices\Model\IndexStatsProvider;
use Smile\ElasticsuiteIndices\Model\ResourceModel\IndexSettings\CollectionFactory as IndexSettingsFactory;
use Smile\ElasticsuiteIndices\Model\ResourceModel\IndexSettings\CollectionFactory;

/**
* Adminhtml Analysis by Analyzer Block.
Expand All @@ -34,26 +34,26 @@ class Analyzer extends Template
protected $indexStatsProvider;

/**
* @var IndexSettingsFactory
* @var CollectionFactory
*/
protected $indexSettingsFactory;
protected $collectionFactory;

/**
* Analyzer Constructor.
*
* @param Template\Context $context The current context.
* @param IndexStatsProvider $indexStatsProvider Index stats provider.
* @param IndexSettingsFactory $indexSettingsFactory Index settings factory.
* @param array $data Data.
* @param Template\Context $context The current context.
* @param IndexStatsProvider $indexStatsProvider Index stats provider.
* @param CollectionFactory $collectionFactory Index settings factory.
* @param array $data Data.
*/
public function __construct(
Template\Context $context,
IndexStatsProvider $indexStatsProvider,
IndexSettingsFactory $indexSettingsFactory,
CollectionFactory $collectionFactory,
array $data = []
) {
$this->indexStatsProvider = $indexStatsProvider;
$this->indexSettingsFactory = $indexSettingsFactory;
$this->indexStatsProvider = $indexStatsProvider;
$this->collectionFactory = $collectionFactory;
parent::__construct($context, $data);
}

Expand All @@ -77,7 +77,7 @@ public function getElasticSuiteIndices(): ?array

foreach ($elasticSuiteIndices as $indexName => $indexAlias) {
$indexData = $this->indexStatsProvider->indexStats($indexName, $indexAlias);
$indexCollection = $this->indexSettingsFactory->create(['name' => $indexData['index_name']])->load();
$indexCollection = $this->collectionFactory->create(['name' => $indexData['index_name']])->load();

if (array_key_exists('index_status', $indexData)
&& !in_array($indexData['index_status'], $excludedIndexStatus)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use Magento\Backend\Block\Template;
use Smile\ElasticsuiteIndices\Model\ResourceModel\IndexMapping\Collection;
use Smile\ElasticsuiteIndices\Model\ResourceModel\IndexMapping\CollectionFactory as IndexMappingFactory;
use Smile\ElasticsuiteIndices\Model\ResourceModel\IndexMapping\CollectionFactory;

/**
* Adminhtml Index mapping items grid
Expand All @@ -27,23 +27,23 @@
class Mapping extends Template
{
/**
* @var IndexMappingFactory
* @var CollectionFactory
*/
protected $indexMappingFactory;
protected $collectionFactory;

/**
* Index mapping items constructor.
*
* @param Template\Context $context The current context.
* @param IndexMappingFactory $indexMappingFactory Index mapping factory.
* @param array $data Data.
* @param Template\Context $context The current context.
* @param CollectionFactory $collectionFactory Index mapping factory.
* @param array $data Data.
*/
public function __construct(
Template\Context $context,
IndexMappingFactory $indexMappingFactory,
CollectionFactory $collectionFactory,
array $data = []
) {
$this->indexMappingFactory = $indexMappingFactory;
$this->collectionFactory = $collectionFactory;
parent::__construct($context, $data);
}

Expand All @@ -54,6 +54,6 @@ public function __construct(
*/
public function getItemsCollection(): Collection
{
return $this->indexMappingFactory->create(['name' => $this->getRequest()->getParam('name')])->load();
return $this->collectionFactory->create(['name' => $this->getRequest()->getParam('name')])->load();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use Magento\Backend\Block\Template;
use Smile\ElasticsuiteIndices\Model\ResourceModel\IndexSettings\Collection;
use Smile\ElasticsuiteIndices\Model\ResourceModel\IndexSettings\CollectionFactory as IndexSettingsFactory;
use Smile\ElasticsuiteIndices\Model\ResourceModel\IndexSettings\CollectionFactory;

/**
* Adminhtml Index mapping items grid
Expand All @@ -27,23 +27,23 @@
class Settings extends Template
{
/**
* @var IndexSettingsFactory
* @var CollectionFactory
*/
protected $indexSettingsFactory;
protected $collectionFactory;

/**
* Index mapping items constructor.
*
* @param Template\Context $context The current context.
* @param IndexSettingsFactory $indexSettingsFactory Index mapping factory.
* @param array $data Data.
* @param Template\Context $context The current context.
* @param CollectionFactory $collectionFactory Index mapping factory.
* @param array $data Data.
*/
public function __construct(
Template\Context $context,
IndexSettingsFactory $indexSettingsFactory,
CollectionFactory $collectionFactory,
array $data = []
) {
$this->indexSettingsFactory = $indexSettingsFactory;
$this->collectionFactory = $collectionFactory;
parent::__construct($context, $data);
}

Expand All @@ -54,6 +54,6 @@ public function __construct(
*/
public function getItemsCollection(): Collection
{
return $this->indexSettingsFactory->create(['name' => $this->getRequest()->getParam('name')])->load();
return $this->collectionFactory->create(['name' => $this->getRequest()->getParam('name')])->load();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct(
$this->client = $client;
$this->resultJsonFactory = $resultJsonFactory;

return parent::__construct($context);
parent::__construct($context);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,18 @@ public function execute()
{
$indexName = $this->getRequest()->getParam('name');
try {
$index = $this->indexMappingProvider->getMapping($indexName);
$this->indexMappingProvider->getMapping($indexName);
} catch (\Exception $e) {
$resultForward = $this->resultForwardFactory->create();
$resultForward->forward('noroute');

return $resultForward;
}

if ($index) {
$resultPage = $this->resultPageFactory->create();
$resultPage->getLayout()->getBlock('smile_elasticsuite_indices_index_mapping');
$resultPage = $this->resultPageFactory->create();
$resultPage->getLayout()->getBlock('smile_elasticsuite_indices_index_mapping');
$resultPage->getConfig()->getTitle()->prepend(__('Mapping for index:') . ' ' . $indexName);

$resultPage->getConfig()->getTitle()->prepend(__('Mapping for index:') . ' ' . $indexName);

return $resultPage;
}
return $resultPage;
}
}
Loading

0 comments on commit 7ed87e2

Please sign in to comment.