Skip to content

#10922 add is_active to Magento\Store\Api\Data\StoreInterface #10923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2017
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions app/code/Magento/Store/Api/Data/StoreInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ public function setWebsiteId($websiteId);
*/
public function getStoreGroupId();

/**
* @param int $isActive
* @return $this
*/
public function setIsActive($isActive);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, introduction of any new methods to the @api interfaces is not possible due to backwards compatibility policy. This change can potentially break any third-party customization which used this class as SPI (providing their own implementation for existing interface).

Possible workaround would be implementing an extension attribute for this class which would contain the required field. This would not break any existing customization but as a tradeoff would look not as good.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change was accepted by Anton even though it gave backward compliance issue. I am happy to give a go with the extension attribute but I'd say any developer would see this change as more beneficial as it is now.
--> what I mean is Magento 2 is complex enough to avoid making minor issue to become a big problem?


/**
* @return int
*/
public function getIsActive();

/**
* @param int $storeGroupId
* @return $this
Expand Down
17 changes: 16 additions & 1 deletion app/code/Magento/Store/Model/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* @method int getSortOrder()
* @method int getStoreId()
* @method Store setSortOrder($value)
* @method Store setIsActive($value)
*
* @SuppressWarnings(PHPMD.TooManyFields)
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
Expand Down Expand Up @@ -1088,6 +1087,22 @@ public function setStoreGroupId($storeGroupId)
return $this->setGroupId($storeGroupId);
}

/**
* @inheritdoc
*/
public function getIsActive()
{
return $this->_getData('is_active');
}

/**
* @inheritdoc
*/
public function setIsActive($isActive)
{
return $this->setData('is_active', $isActive);
}

/**
* Retrieve default group identifier
*
Expand Down