Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Model/ResourceModel/Post/Fulltext/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public function __construct(
\Smile\ElasticsuiteCore\Search\Request\Builder $requestBuilder,
\Magento\Search\Model\SearchEngine $searchEngine,
$searchRequestName = 'blog_search_container',
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
?\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
?\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
) {

parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $date, $storeManager, $connection, $resource);
Expand Down Expand Up @@ -123,11 +123,18 @@ public function setStoreId($storeId)
/**
* Returns current store id.
*
* Falls back to the current store when no store filter was set,
* e.g. when the collection is built on the catalogsearch result page.
*
* @return int
*/
public function getStoreId()
public function getStoreId(): int
{
return $this->storeId;
if ($this->storeId === null) {
$this->storeId = (int) $this->_storeManager->getStore()->getId();
}

return (int) $this->storeId;
}

/**
Expand Down