Skip to content

Unable to install Magento 2 if a console command depends on ProductRepositoryInterface #22777

Closed
@marcusirgens

Description

@marcusirgens

Preconditions (*)

  1. Have an env.php file
  2. Magento 2.2.7, Magento 2.2.8, Magento 2.3.1 with any custom command that uses ProductRepositoryInterface
  3. With the fixes from Fix #21692 #21752 - logic in constructor of address validator and Locale Resolver check #21693 this does not occur on 2.3.1
  4. This issue still occurs on 2.2.7 with fixes from [Backport] Fix #21692 #21752 - logic in constructor of address validator and Locale Resolver check #21719 applied

Steps to reproduce (*)

  1. Install a custom CLI command that injects Magento\Catalog\Api\ProductRepositoryInterface into its constructor
  2. Set up an env file with your environment settings
  3. Install Magento from CLI

Expected result (*)

Magento will be installed

Actual result (*)

Magento is not installed. At step 4, Installing database schema, the installer will fail with the exception:
Base table or view not found: 1146 Table 'YOUR_DATABASE_NAME.store_website' doesn't exist
The exception occurs because Magento\Framework\Locale\Resolver has logic in its constructor that ends up making a database query. The "creation stack" goes down through \Magento\Framework\Stdlib\DateTime\Timezone -> Magento\Framework\Stdlib\DateTime\Filter\Date -> Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper -> \Magento\Catalog\Model\ProductRepository.

Metadata

Metadata

Assignees

Labels

Issue: Format is validGate 1 Passed. Automatic verification of issue format passed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions