/** * If product saved on default store view, then need to check specific url_key for other stores * * @param int $storeId * @param int $productId * @return bool */ public function isNeedCreateUrlRewrite($storeId, $productId) { $attribute = $this->eavConfig->getAttribute(Product::ENTITY, 'url_key'); $select = $this->connection->select()->from($attribute->getBackendTable(), 'store_id')->where('attribute_id = ?', $attribute->getId())->where('entity_id = ?', $productId); return !in_array($storeId, $this->connection->fetchCol($select)); }