Skip to content

Not clear logic for loading CMS Pages with setStoreId function  #22767

@Sharkozp

Description

@Sharkozp

Preconditions (*)

  1. 2.1.x
  2. 2.2.x
  3. 2.3.x

Steps to reproduce (*)

  1. Create some class that will load CMS Page:
 /**
     * Constructor.
     */
    public function __construct(
        \Magento\Cms\Model\PageFactory $pageFactory
    ) {
        $this->pageFactory = $pageFactory;
    }

/** @var \Magento\Cms\Model\Page $page */
$page = $this->pageFactory->create();
$page->setStoreId([2]);
$page->load($identifier, Page::IDENTIFIER);
  1. According to description for magic function setStoreId must be array in Magento\Cms\Model\Page:
    * @method Page setStoreId(array $storeId)

Link

  1. But in Magento\Cms\Model\ResourceModel\Page in method _getLoadSelect you have this part of code:
 if ($object->getStoreId()) {
            $storeIds = [
                Store::DEFAULT_STORE_ID,
                (int)$object->getStoreId(),
            ];
......
}

Link

  1. If you will provide array it will be just 1 and not merged with provided array.

Expected result (*)

  1. If description correct and store_id must be array, then in Resource Model must be changed logic for merging array
  2. If it must be just int, then it must be changed description for magic function in Magento\Cms\Model\Page

Actual result (*)

  1. See steps

Metadata

Metadata

Labels

Component: CmsFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions