Skip to content

Commit 68889e9

Browse files
committed
Added getStoreId method to collections
1 parent ac4c564 commit 68889e9

File tree

3 files changed

+41
-16
lines changed

3 files changed

+41
-16
lines changed

Model/ResourceModel/Category/Collection.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,12 @@ protected function _toTree($itemId, $childs, &$tree)
275275
}
276276
}
277277
}
278+
279+
/**
280+
* @return int
281+
*/
282+
public function getStoreId():int
283+
{
284+
return (int)$this->_storeId;
285+
}
278286
}

Model/ResourceModel/Post/Collection.php

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,17 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab
7575
* @param \Magefan\Blog\Api\CategoryRepositoryInterface|null $categoryRepository
7676
*/
7777
public function __construct(
78-
\Magento\Framework\Data\Collection\EntityFactory $entityFactory,
79-
\Psr\Log\LoggerInterface $logger,
78+
\Magento\Framework\Data\Collection\EntityFactory $entityFactory,
79+
\Psr\Log\LoggerInterface $logger,
8080
\Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
81-
\Magento\Framework\Event\ManagerInterface $eventManager,
82-
\Magento\Framework\Stdlib\DateTime\DateTime $date,
83-
\Magento\Store\Model\StoreManagerInterface $storeManager,
84-
$connection = null,
85-
?\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null,
86-
?\Magefan\Blog\Api\CategoryRepositoryInterface $categoryRepository = null
87-
) {
81+
\Magento\Framework\Event\ManagerInterface $eventManager,
82+
\Magento\Framework\Stdlib\DateTime\DateTime $date,
83+
\Magento\Store\Model\StoreManagerInterface $storeManager,
84+
$connection = null,
85+
?\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null,
86+
?\Magefan\Blog\Api\CategoryRepositoryInterface $categoryRepository = null
87+
)
88+
{
8889
parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);
8990
$this->_date = $date;
9091
$this->_storeManager = $storeManager;
@@ -165,7 +166,7 @@ public function addFieldToFilter($field, $condition = null)
165166

166167
/**
167168
* Add store filter to collection
168-
* @param array|int|\Magento\Store\Model\Store $store
169+
* @param array|int|\Magento\Store\Model\Store $store
169170
* @param boolean $withAdmin
170171
* @return $this
171172
*/
@@ -227,7 +228,7 @@ public function addRecentFilter()
227228

228229
/**
229230
* Add posts filter to collection
230-
* @param array|int|string $category
231+
* @param array|int|string $category
231232
* @return $this
232233
*/
233234
public function addPostsFilter($postIds)
@@ -254,7 +255,7 @@ public function addPostsFilter($postIds)
254255

255256
/**
256257
* Add category filter to collection
257-
* @param array|int|\Magefan\Blog\Model\Category $category
258+
* @param array|int|\Magefan\Blog\Model\Category $category
258259
* @return $this
259260
*/
260261
public function addCategoryFilter($category)
@@ -442,7 +443,7 @@ public function getSearchRateExpression($term, array $columns): string
442443

443444
/**
444445
* Add tag filter to collection
445-
* @param array|int|string|\Magefan\Blog\Model\Tag $tag
446+
* @param array|int|string|\Magefan\Blog\Model\Tag $tag
446447
* @return $this
447448
*/
448449
public function addTagFilter($tag)
@@ -520,7 +521,7 @@ public function addTagFilter($tag)
520521

521522
/**
522523
* Add author filter to collection
523-
* @param array|int|\Magefan\Blog\Model\Author $author
524+
* @param array|int|\Magefan\Blog\Model\Author $author
524525
* @return $this
525526
*/
526527
public function addAuthorFilter($author)
@@ -727,8 +728,8 @@ protected function _renderFiltersBefore()
727728
/**
728729
* Add select order
729730
*
730-
* @param string $field
731-
* @param string $direction
731+
* @param string $field
732+
* @param string $direction
732733
* @return $this
733734
*/
734735
public function setOrder($field, $direction = self::SORT_ORDER_DESC)
@@ -740,4 +741,12 @@ public function setOrder($field, $direction = self::SORT_ORDER_DESC)
740741
}
741742
return $this;
742743
}
744+
745+
/**
746+
* @return int
747+
*/
748+
public function getStoreId():int
749+
{
750+
return (int)$this->_storeId;
751+
}
743752
}

Model/ResourceModel/Tag/Collection.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,12 @@ protected function _renderFiltersBefore()
211211
}
212212
parent::_renderFiltersBefore();
213213
}
214+
215+
/**
216+
* @return int
217+
*/
218+
public function getStoreId():int
219+
{
220+
return (int)$this->_storeId;
221+
}
214222
}

0 commit comments

Comments
 (0)