Created
January 3, 2019 07:36
-
-
Save johnorourke/5a7846c75382d739915a67251b069e18 to your computer and use it in GitHub Desktop.
Patch to add store_id support to CMS API Block and Page interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git Api/Data/BlockInterface.php Api/Data/BlockInterface.php | |
index 68110b5..353dae8 100644 | |
--- Api/Data/BlockInterface.php | |
+++ Api/Data/BlockInterface.php | |
@@ -22,6 +22,7 @@ interface BlockInterface | |
const CREATION_TIME = 'creation_time'; | |
const UPDATE_TIME = 'update_time'; | |
const IS_ACTIVE = 'is_active'; | |
+ const STORE_ID = 'store_id'; | |
/**#@-*/ | |
/** | |
@@ -74,6 +75,13 @@ interface BlockInterface | |
public function isActive(); | |
/** | |
+ * Get stores | |
+ * | |
+ * @return int[]|null | |
+ */ | |
+ public function getStoreId(); | |
+ | |
+ /** | |
* Set ID | |
* | |
* @param int $id | |
@@ -128,4 +136,12 @@ interface BlockInterface | |
* @return BlockInterface | |
*/ | |
public function setIsActive($isActive); | |
+ | |
+ /** | |
+ * Set stores | |
+ * | |
+ * @param int[]|null $stores | |
+ * @return BlockInterface | |
+ */ | |
+ public function setStoreId(array $stores = null); | |
} | |
diff --git Api/Data/PageInterface.php Api/Data/PageInterface.php | |
index 032f491..b3786f1 100644 | |
--- Api/Data/PageInterface.php | |
+++ Api/Data/PageInterface.php | |
@@ -34,6 +34,7 @@ interface PageInterface | |
const CUSTOM_THEME_FROM = 'custom_theme_from'; | |
const CUSTOM_THEME_TO = 'custom_theme_to'; | |
const IS_ACTIVE = 'is_active'; | |
+ const STORE_ID = 'store_id'; | |
/**#@-*/ | |
/** | |
@@ -171,6 +172,13 @@ interface PageInterface | |
public function isActive(); | |
/** | |
+ * Get stores | |
+ * | |
+ * @return int[]|null | |
+ */ | |
+ public function getStoreId(); | |
+ | |
+ /** | |
* Set ID | |
* | |
* @param int $id | |
@@ -322,4 +330,12 @@ interface PageInterface | |
* @return \Magento\Cms\Api\Data\PageInterface | |
*/ | |
public function setIsActive($isActive); | |
+ | |
+ /** | |
+ * Set stores | |
+ * | |
+ * @param int[]|null $stores | |
+ * @return \Magento\Cms\Api\Data\PageInterface | |
+ */ | |
+ public function setStoreId(array $stores = null); | |
} | |
diff --git Model/Block.php Model/Block.php | |
index e65675c..6ec0a66 100644 | |
--- Model/Block.php | |
+++ Model/Block.php | |
@@ -11,9 +11,6 @@ use Magento\Framework\Model\AbstractModel; | |
/** | |
* CMS block model | |
- * | |
- * @method Block setStoreId(array $storeId) | |
- * @method array getStoreId() | |
*/ | |
class Block extends AbstractModel implements BlockInterface, IdentityInterface | |
{ | |
@@ -150,6 +147,16 @@ class Block extends AbstractModel implements BlockInterface, IdentityInterface | |
} | |
/** | |
+ * Get stores | |
+ * | |
+ * @return int[]|null | |
+ */ | |
+ public function getStoreId() | |
+ { | |
+ return $this->getData(self::STORE_ID); | |
+ } | |
+ | |
+ /** | |
* Set ID | |
* | |
* @param int $id | |
@@ -227,6 +234,17 @@ class Block extends AbstractModel implements BlockInterface, IdentityInterface | |
} | |
/** | |
+ * Set stores | |
+ * | |
+ * @param int[]|null $stores | |
+ * @return BlockInterface | |
+ */ | |
+ public function setStoreId(array $stores = null) | |
+ { | |
+ return $this->setData(self::STORE_ID, $stores); | |
+ } | |
+ | |
+ /** | |
* Receive page store ids | |
* | |
* @return int[] | |
diff --git Model/Page.php Model/Page.php | |
index d950f48..c040033 100644 | |
--- Model/Page.php | |
+++ Model/Page.php | |
@@ -16,8 +16,6 @@ use Magento\Framework\Model\AbstractModel; | |
* Cms Page Model | |
* | |
* @api | |
- * @method Page setStoreId(array $storeId) | |
- * @method array getStoreId() | |
* @SuppressWarnings(PHPMD.ExcessivePublicCount) | |
* @since 100.0.2 | |
*/ | |
@@ -328,6 +326,16 @@ class Page extends AbstractModel implements PageInterface, IdentityInterface | |
} | |
/** | |
+ * Get stores | |
+ * | |
+ * @return int[]|null | |
+ */ | |
+ public function getStoreId() | |
+ { | |
+ return $this->getData(self::STORE_ID); | |
+ } | |
+ | |
+ /** | |
* Set ID | |
* | |
* @param int $id | |
@@ -538,6 +546,17 @@ class Page extends AbstractModel implements PageInterface, IdentityInterface | |
} | |
/** | |
+ * Set stores | |
+ * | |
+ * @param int[]|null $stores | |
+ * @return \Magento\Cms\Api\Data\PageInterface | |
+ */ | |
+ public function setStoreId(array $stores = null) | |
+ { | |
+ return $this->setData(self::STORE_ID, $stores); | |
+ } | |
+ | |
+ /** | |
* {@inheritdoc} | |
* @since 101.0.0 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment