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
magento setup command is throwing magento.flag does't exist. #4
Comments
|
Same here ! Starting Magento installation: [Zend_Db_Statement_Exception] |
|
Try to delete your env.php file in app/etc/env.php That fixed it for me. |
|
While @gigadesign1 provides a viable solution, I think it's important to continue to understand the why. I haven't been able to yet isolate which module (presumably a core module) creates the condition, but I found a related issue here which speaks to how dependency injection can initialize things unexpectedly: |
|
Ok, so , @vbuck is right. This is not not an issue with the cache , or env.php or anything. This is an issue with custom commands cli. Indeed , for example , if you are adding Dependency injection in your custom command cli for storeManager for example this won't work. Just comment out every custom command for installation and it will work. On my side what I did , is changing the the dependency injection , and using object Manager instead. This is a bad practice . but I think for command cli , this is the best thing to do. This is clearly an issue of the conception in Magento core. Good luck guys |
|
To continue on this subject. This issue can indeed come from custom commands cli, but there is a second possibility. If you (or any modules you install) override a class that is used by the magento setup, and modifies the dependencies and adds for example a dependency to storeManager you will get the same error. For example if you override I would say the way to debug this is to :
Modify if (!isset($this->_sharedInstances[$type])) {
try {
$this->_sharedInstances[$type] = $this->_factory->create($type);
} catch (\Exception $exception) {
echo "At fault : $type\n";
throw $exception;
}
}This will print before the exception something like Which allows me to see that the issue is with Good luck finding your issues. |
|
Instead of using the ObjectManager you could inject a proxy class instead! https://devdocs.magento.com/guides/v2.4/extension-dev-guide/proxies.html |
|
The solution by @oliverde8 helped me also... by injecting that code into the ObjectManager.php This should be a standard in Magento code to help debug such problems... |
|
This worked for me on Adobe commerce 2.3 |
|
Here is a working solution to prevent issues with custom CLI commands using the connection to DB in constructors: https://github.com/run-as-root/magento-cli-auto-proxy
It automatically makes proxies for all CLI command arguments. P.S.: for sure, it is better to fix your code by using proxies, for example, but if you have no control over an extension with this problem - current solution will help you out. |
While hitting the command:
magento setup:install --db-host=db --db-name=magento2 --db-user=root --db-password=root --admin-firstname=Magento --admin-lastname=Administrator --admin-email=user@example.com --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --backend-frontname=adminAn error is thrown as:
[Zend_Db_Statement_Exception]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento2.flag' doesn't exist, query wa
s: SELECT
flag.* FROMflagWHERE (flag.flag_code='staging')[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento2.flag' doesn't exist
Please help!
The text was updated successfully, but these errors were encountered: