storeManager = $storeManager; } /** * Define resource model * * @return void */ protected function _construct() { $this->_init( \Magento\UrlRewrite\Model\UrlRewrite::class, \Magento\UrlRewrite\Model\ResourceModel\UrlRewrite::class ); } /** * Filter collections by stores * * @param mixed $store * @param bool $withAdmin * @return $this * @api */ public function addStoreFilter($store, $withAdmin = true) { if (!is_array($store)) { $store = [$this->storeManager->getStore($store)->getId()]; } if ($withAdmin) { $store[] = 0; } $this->addFieldToFilter('store_id', ['in' => $store]); return $this; } }