Skip to content

Conversation

@elvinristi
Copy link

Fix error when running "php bin/magento setup:upgrade" which throws e…rror when you first time initilise project.

Magento\Framework\Exception\LocalizedException: Wrong entity ID in <project>/vendor/magento/module-eav/Setup/EavSetup.php on line 265 

Call stack:

 ... ... 28.0230 65761576 9. Magento\Setup\Model\Installer->handleDBSchemaData($setup = class Magento\Setup\Module\Setup { private ${Magento\Framework\Module\Setup}:connection = class Magento\Framework\DB\Adapter\Pdo\Mysql { protected $_defaultStmtClass = 'Magento\\Framework\\DB\\Statement\\Pdo\\Mysql'; protected $_transactionLevel = 0; protected $_isRolledBack = FALSE; protected $_connectionFlagsSet = TRUE; protected $_ddlCache = array (...); protected $_bindParams = array (...); protected $_bindIncrement = 0; protected $_cacheAdapter = NULL; protected $_isDdlCacheAllowed = TRUE; protected $_ddlColumnTypes = array (...); protected $_ddlRoutines = array (...); protected $_intervalUnits = array (...); protected $_queryHook = NULL; protected $string = class Magento\Framework\Stdlib\StringUtils { ... }; protected $dateTime = class Magento\Framework\Stdlib\DateTime { ... }; protected $selectFactory = class Magento\Framework\DB\SelectFactory { ... }; protected $logger = class Magento\Framework\DB\Logger\Quiet { ... }; private $queryGenerator = NULL; protected $_pdoType = 'mysql'; protected $_numericDataTypes = array (...); protected $_config = array (...); protected $_fetchMode = 2; protected $_profiler = class Zend_Db_Profiler { ... }; protected $_defaultProfilerClass = 'Zend_Db_Profiler'; protected $_connection = class PDO { ... }; protected $_caseFolding = 0; protected $_autoQuoteIdentifiers = TRUE; protected $_allowSerialization = TRUE; protected $_autoReconnectOnUnserialize = FALSE }; private ${Magento\Framework\Module\Setup}:tables = array ('setup_module' => 'setup_module', 'session' => 'session', 'cache' => 'cache', 'cache_tag' => 'cache_tag', 'flag' => 'flag'); private ${Magento\Framework\Module\Setup}:resourceModel = class Magento\Framework\App\ResourceConnection { protected $connections = array (...); protected $mappedTableNames = NULL; protected $config = class Magento\Setup\Module\Setup\ResourceConfig { ... }; protected $connectionFactory = class Magento\Setup\Module\ConnectionFactory { ... }; private $deploymentConfig = class Magento\Framework\App\DeploymentConfig { ... }; protected $tablePrefix = '' }; private ${Magento\Framework\Module\Setup}:connectionName = 'default_setup' }, $type = 'schema') <project>/setup/src/Magento/Setup/Model/Installer.php:779 28.3420 66160784 10. Df\Framework\Upgrade\Schema->upgrade($setup = class Magento\Setup\Module\Setup { private ${Magento\Framework\Module\Setup}:connection = class Magento\Framework\DB\Adapter\Pdo\Mysql { protected $_defaultStmtClass = 'Magento\\Framework\\DB\\Statement\\Pdo\\Mysql'; protected $_transactionLevel = 0; protected $_isRolledBack = FALSE; protected $_connectionFlagsSet = TRUE; protected $_ddlCache = array (...); protected $_bindParams = array (...); protected $_bindIncrement = 0; protected $_cacheAdapter = NULL; protected $_isDdlCacheAllowed = TRUE; protected $_ddlColumnTypes = array (...); protected $_ddlRoutines = array (...); protected $_intervalUnits = array (...); protected $_queryHook = NULL; protected $string = class Magento\Framework\Stdlib\StringUtils { ... }; protected $dateTime = class Magento\Framework\Stdlib\DateTime { ... }; protected $selectFactory = class Magento\Framework\DB\SelectFactory { ... }; protected $logger = class Magento\Framework\DB\Logger\Quiet { ... }; private $queryGenerator = NULL; protected $_pdoType = 'mysql'; protected $_numericDataTypes = array (...); protected $_config = array (...); protected $_fetchMode = 2; protected $_profiler = class Zend_Db_Profiler { ... }; protected $_defaultProfilerClass = 'Zend_Db_Profiler'; protected $_connection = class PDO { ... }; protected $_caseFolding = 0; protected $_autoQuoteIdentifiers = TRUE; protected $_allowSerialization = TRUE; protected $_autoReconnectOnUnserialize = FALSE }; private ${Magento\Framework\Module\Setup}:tables = array ('setup_module' => 'setup_module', 'session' => 'session', 'cache' => 'cache', 'cache_tag' => 'cache_tag', 'flag' => 'flag'); private ${Magento\Framework\Module\Setup}:resourceModel = class Magento\Framework\App\ResourceConnection { protected $connections = array (...); protected $mappedTableNames = NULL; protected $config = class Magento\Setup\Module\Setup\ResourceConfig { ... }; protected $connectionFactory = class Magento\Setup\Module\ConnectionFactory { ... }; private $deploymentConfig = class Magento\Framework\App\DeploymentConfig { ... }; protected $tablePrefix = '' }; private ${Magento\Framework\Module\Setup}:connectionName = 'default_setup' }, $context = class Magento\Setup\Model\ModuleContext { private $version = '' }) <project>/setup/src/Magento/Setup/Model/Installer.php:849 28.3420 66160784 11. Df\Framework\Upgrade->process($setup = class Magento\Setup\Module\Setup { private ${Magento\Framework\Module\Setup}:connection = class Magento\Framework\DB\Adapter\Pdo\Mysql { protected $_defaultStmtClass = 'Magento\\Framework\\DB\\Statement\\Pdo\\Mysql'; protected $_transactionLevel = 0; protected $_isRolledBack = FALSE; protected $_connectionFlagsSet = TRUE; protected $_ddlCache = array (...); protected $_bindParams = array (...); protected $_bindIncrement = 0; protected $_cacheAdapter = NULL; protected $_isDdlCacheAllowed = TRUE; protected $_ddlColumnTypes = array (...); protected $_ddlRoutines = array (...); protected $_intervalUnits = array (...); protected $_queryHook = NULL; protected $string = class Magento\Framework\Stdlib\StringUtils { ... }; protected $dateTime = class Magento\Framework\Stdlib\DateTime { ... }; protected $selectFactory = class Magento\Framework\DB\SelectFactory { ... }; protected $logger = class Magento\Framework\DB\Logger\Quiet { ... }; private $queryGenerator = NULL; protected $_pdoType = 'mysql'; protected $_numericDataTypes = array (...); protected $_config = array (...); protected $_fetchMode = 2; protected $_profiler = class Zend_Db_Profiler { ... }; protected $_defaultProfilerClass = 'Zend_Db_Profiler'; protected $_connection = class PDO { ... }; protected $_caseFolding = 0; protected $_autoQuoteIdentifiers = TRUE; protected $_allowSerialization = TRUE; protected $_autoReconnectOnUnserialize = FALSE }; private ${Magento\Framework\Module\Setup}:tables = array ('setup_module' => 'setup_module', 'session' => 'session', 'cache' => 'cache', 'cache_tag' => 'cache_tag', 'flag' => 'flag'); private ${Magento\Framework\Module\Setup}:resourceModel = class Magento\Framework\App\ResourceConnection { protected $connections = array (...); protected $mappedTableNames = NULL; protected $config = class Magento\Setup\Module\Setup\ResourceConfig { ... }; protected $connectionFactory = class Magento\Setup\Module\ConnectionFactory { ... }; private $deploymentConfig = class Magento\Framework\App\DeploymentConfig { ... }; protected $tablePrefix = '' }; private ${Magento\Framework\Module\Setup}:connectionName = 'default_setup' }, $context = class Magento\Setup\Model\ModuleContext { private $version = '' }) <project>/vendor/mage2pro/core/Framework/Upgrade/Schema.php:59 28.3432 66160784 12. Df\Customer\Setup\UpgradeSchema->_process() <project>/vendor/mage2pro/core/Framework/Upgrade.php:98 128.5908 66587088 13. Magento\Eav\Setup\EavSetup->addAttribute($entityTypeId = 'customer', $code = 'df', $attr = array ('input' => 'text', 'label' => 'Mage2.PRO', 'position' => 1000, 'required' => FALSE, 'sort_order' => 1000, 'system' => FALSE, 'type' => 'static', 'visible' => FALSE)) <project>/vendor/mage2pro/core/Customer/Setup/UpgradeSchema.php:29 138.0007 66587088 14. Magento\Eav\Setup\EavSetup->getEntityTypeId($entityTypeId = FALSE) <project>/vendor/magento/module-eav/Setup/EavSetup.php:800 
…rror when you first time initilise project. ``` Magento\Framework\Exception\LocalizedException: Wrong entity ID in <project>/vendor/magento/module-eav/Setup/EavSetup.php on line 265 ```
@dmitrii-fediuk
Copy link
Member

I have already commented it here: https://mage2.pro/t/topic/4235/4

You should install the Mage2.PRO packages after Magento 2 installation, not before.
So you will not encounter such errors «when installing Magento 2».

Why do not you want to follow this rule?
Why do you need to install extensions before Magento 2 installation?

@elvinristi
Copy link
Author

@dmitry-fedyuk , this can't be done to add "after". They need to come "together".

Proposed "rule" is not valid for Magento 2.

In CI process project is built from scratch and image file is generated and all conditions must be met with empty database what is created by setup-scripts.

Unfortunately in this module data addition happens in schema class where should be ONLY happen sql structure updates.

@dmitrii-fediuk dmitrii-fediuk changed the title Fix error when running "php bin/magento setup:upgrade" [ERROR] Magento\Framework\Exception\LocalizedException: Wrong entity ID in vendor/magento/module-eav/Setup/EavSetup.php:265 Oct 14, 2017
dmitrii-fediuk added a commit that referenced this pull request Oct 14, 2017
@dmitrii-fediuk
Copy link
Member

OK, I have included your pull request to the 3.2.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants