Skip to content

setup/*.xml Config Files Not Read During Setup #2725

Closed
@CNanninga

Description

@CNanninga

Some areas of the core code have config files defined for the "setup" area. E.g., Magento_CmsUrlRewrite/etc/setup/events.xml. However, these config files are not read during the command-line setup:upgrade operation.

Reproduction steps:

  1. Create a module data upgrade script that saves a new CMS page.
  2. Run "magento setup:upgrade".
  3. Observe that, in the database, a new record exists in cms_page for the new page, but no new record exists in url_rewrite (which would normally occur when saving a new page in the admin).

The logic that is responsible for saving this URL rewrite record is in an observer defined in Magento_CmsUrlRewrite/etc/adminhtml/events.xml and Magento_CmsUrlRewrite/etc/setup/events.xml. This works fine for the adminhtml area, but no setup area is ever loaded.

Areas are defined in di.xml in the "areas" argument of Magento\Framework\App\AreaList. There are no di.xml files defining a "setup" item in this argument. I have confirmed that, when running "magento setup:upgrade", the result of Magento\Framework\Config::getCurrentScope (which returns "frontend" when the area context is "frontend") is "global".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions