-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix Magento\Review\Model\ResourceModel\Rating\Option not instantiable in setup scripts #5465
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… in setup scripts `Magento\Review\Model\ResourceModel\Rating\Option` depends on `\Magento\Customer\Model\Session` and this makes it not instantiable in setup scripts. By making it a proxy, we're postponing its instantiation. ```php // some setup script $optionModel = $objectManager->create(Magento\Review\Model\Rating\Option::class); ``` Below is the exceptions triggered when trying to run a `setup:upgrade` ``` [Magento\Framework\Exception\SessionException] Area code not set: Area code must be set before starting a session. Exception trace: () at /vagrant/vendor/magento/framework/Session/SessionManager.php:175 Magento\Framework\Session\SessionManager->start() at /vagrant/vendor/magento/framework/Session/SessionManager.php:130 Magento\Framework\Session\SessionManager->__construct() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:115 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:89 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:236 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:53 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:82 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:236 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:53 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:82 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:461 Magento\Framework\Model\AbstractModel->_getResource() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:214 Magento\Framework\Model\AbstractModel->_init() at /vagrant/vendor/magento/module-review/Model/Rating/Option.php:32 Magento\Review\Model\Rating\Option->_construct() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:193 Magento\Framework\Model\AbstractModel->__construct() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:105 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:89 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:57 Magento\Framework\ObjectManager\ObjectManager->create() at /vagrant/src/Project/Catalog/Setup/data-upgrade/1.1.25.php:56 include() at /vagrant/src/Project/ModuleSetup/Spi/Updater/SequentialFiles.php:96 Project\ModuleSetup\Spi\Updater\includeFile() at /vagrant/src/Project/ModuleSetup/Spi/Updater/SequentialFiles.php:88 Project\ModuleSetup\Spi\Updater\SequentialFiles->update() at /vagrant/src/Project/Catalog/Setup/UpgradeData.php:46 Project\Catalog\Setup\UpgradeData->upgrade() at /vagrant/setup/src/Magento/Setup/Model/Installer.php:809 Magento\Setup\Model\Installer->handleDBSchemaData() at /vagrant/setup/src/Magento/Setup/Model/Installer.php:772 Magento\Setup\Model\Installer->installDataFixtures() at /vagrant/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php:72 Magento\Setup\Console\Command\UpgradeCommand->execute() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257 Symfony\Component\Console\Command\Command->run() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:874 Symfony\Component\Console\Application->doRunCommand() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:195 Symfony\Component\Console\Application->doRun() at /vagrant/vendor/magento/framework/Console/Cli.php:49 Magento\Framework\Console\Cli->doRun() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:126 Symfony\Component\Console\Application->run() at /vagrant/bin/magento:25 [Magento\Framework\Exception\LocalizedException] Area code is not set Exception trace: () at /vagrant/vendor/magento/framework/App/State.php:139 Magento\Framework\App\State->getAreaCode() at /vagrant/vendor/magento/framework/Session/SessionManager.php:173 Magento\Framework\Session\SessionManager->start() at /vagrant/vendor/magento/framework/Session/SessionManager.php:130 Magento\Framework\Session\SessionManager->__construct() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:115 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:89 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:236 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:53 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:82 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:236 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:53 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:82 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:71 Magento\Framework\ObjectManager\ObjectManager->get() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:461 Magento\Framework\Model\AbstractModel->_getResource() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:214 Magento\Framework\Model\AbstractModel->_init() at /vagrant/vendor/magento/module-review/Model/Rating/Option.php:32 Magento\Review\Model\Rating\Option->_construct() at /vagrant/vendor/magento/framework/Model/AbstractModel.php:193 Magento\Framework\Model\AbstractModel->__construct() at /vagrant/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:105 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() at /vagrant/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:89 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() at /vagrant/vendor/magento/framework/ObjectManager/ObjectManager.php:57 Magento\Framework\ObjectManager\ObjectManager->create() at /vagrant/src/Project/Catalog/Setup/data-upgrade/1.1.25.php:56 include() at /vagrant/src/Project/ModuleSetup/Spi/Updater/SequentialFiles.php:96 Project\ModuleSetup\Spi\Updater\includeFile() at /vagrant/src/Project/ModuleSetup/Spi/Updater/SequentialFiles.php:88 Project\ModuleSetup\Spi\Updater\SequentialFiles->update() at /vagrant/src/Project/Catalog/Setup/UpgradeData.php:46 Project\Catalog\Setup\UpgradeData->upgrade() at /vagrant/setup/src/Magento/Setup/Model/Installer.php:809 Magento\Setup\Model\Installer->handleDBSchemaData() at /vagrant/setup/src/Magento/Setup/Model/Installer.php:772 Magento\Setup\Model\Installer->installDataFixtures() at /vagrant/setup/src/Magento/Setup/Console/Command/UpgradeCommand.php:72 Magento\Setup\Console\Command\UpgradeCommand->execute() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257 Symfony\Component\Console\Command\Command->run() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:874 Symfony\Component\Console\Application->doRunCommand() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:195 Symfony\Component\Console\Application->doRun() at /vagrant/vendor/magento/framework/Console/Cli.php:49 Magento\Framework\Console\Cli->doRun() at /vagrant/vendor/symfony/console/Symfony/Component/Console/Application.php:126 Symfony\Component\Console\Application->run() at /vagrant/bin/magento:25 ```
vkorotun
added
Component: Customer
Progress: accept
bug report
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
bugfix
and removed
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
bug report
labels
Aug 3, 2016
Internal ticket - MAGETWO-56793 |
vkorotun
added
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
and removed
linked
labels
Aug 22, 2016
mmansoor-magento
pushed a commit
that referenced
this pull request
Dec 26, 2016
[SOUTH] Bugs: - MAGETWO-52925 Simple child product without a special price still shown as "was (original price)" #4442 #5097 #6645 - for mainline - MAGETWO-60098 Configurable product option price is displayed incorrectly per website - MAGETWO-56793 [GITHUB][PR] Fix Magento\Review\Model\ResourceModel\Rating\Option not instantiable in setup scripts #5465 - MAGETWO-58078 [FT] CreateProductAttributeEntityFromProductPageTest fails - MAGETWO-61725 [GITHUB] Improve address save flow to allow to use custom validators #7552
@mmansoorebay @vkorotun Any idea what version of Magento will include this fix? |
Still not in 2.1.10... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bugfix
Component: Customer
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
Progress: accept
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Magento\Review\Model\ResourceModel\Rating\Option
depends on\Magento\Customer\Model\Session
and this makes it not instantiable in setup scripts. By making it a proxy, we're postponing its instantiation.Below is the exceptions triggered when trying to run a
setup:upgrade