Saw this ages ago and forgot to report, i do believe that its still valid but I have not checked sorry 馃檲
But I do remember the issue pretty well I think.
- Create a cms page
some-page
- Set it as
is_active=0
- Use this tool to try and change some of the content on a store view
The real life scenario was some page was temporarily disabled on production until the automated script could fix it, but the script couldn't fix it because it was is_active=0 and thus could not be loaded for being updated.
This tool uses the GetPageByIdentifier to load
|
try { |
|
$page = $this->getPageByIdentifier->execute($identifier, $storeId); |
|
} catch (NoSuchEntityException $e) { |
|
// Rather than throwing an exception, create a new page instance |
That uses the page resource model
https://github.com/magento/magento2/blob/5a022f69ada01effe32a207000a2391e1c918625/app/code/Magento/Cms/Model/GetPageByIdentifier.php#L43-L47
That uses a function to getPageId
https://github.com/magento/magento2/blob/5a022f69ada01effe32a207000a2391e1c918625/app/code/Magento/Cms/Model/ResourceModel/Page.php#L173-L176
That uses _getLoadSelect
https://github.com/magento/magento2/blob/5a022f69ada01effe32a207000a2391e1c918625/app/code/Magento/Cms/Model/ResourceModel/Page.php#L143-L155
getLoadSelect has hard coded filtering for is_active=1
https://github.com/magento/magento2/blob/5a022f69ada01effe32a207000a2391e1c918625/app/code/Magento/Cms/Model/ResourceModel/Page.php#L190-L207
If the store is set to is_active=0 it could never be loaded in this manner so this tool tries to create a new one, as it thinks it doesn't exist.
I think I had to work around this by using a collection to load the entity, but it was a while ago .
Saw this ages ago and forgot to report, i do believe that its still valid but I have not checked sorry 馃檲
But I do remember the issue pretty well I think.
some-pageis_active=0The real life scenario was some page was temporarily disabled on production until the automated script could fix it, but the script couldn't fix it because it was
is_active=0and thus could not be loaded for being updated.This tool uses the
GetPageByIdentifierto loadmagento2-module-simpledata/Api/Cms/SimplePage.php
Lines 85 to 88 in ef6db3b
That uses the page resource model
https://github.com/magento/magento2/blob/5a022f69ada01effe32a207000a2391e1c918625/app/code/Magento/Cms/Model/GetPageByIdentifier.php#L43-L47
That uses a function to
getPageIdhttps://github.com/magento/magento2/blob/5a022f69ada01effe32a207000a2391e1c918625/app/code/Magento/Cms/Model/ResourceModel/Page.php#L173-L176
That uses
_getLoadSelecthttps://github.com/magento/magento2/blob/5a022f69ada01effe32a207000a2391e1c918625/app/code/Magento/Cms/Model/ResourceModel/Page.php#L143-L155
getLoadSelecthas hard coded filtering foris_active=1https://github.com/magento/magento2/blob/5a022f69ada01effe32a207000a2391e1c918625/app/code/Magento/Cms/Model/ResourceModel/Page.php#L190-L207
If the store is set to
is_active=0it could never be loaded in this manner so this tool tries to create a new one, as it thinks it doesn't exist.I think I had to work around this by using a collection to load the entity, but it was a while ago .