Magento eav实体设置失败 - 无法创建表

Mar*_*ang 4 magento entity-attribute-value

我试图在Magento 1.7.0.0中设置一个自定义实体,跟随alan风暴文章关于它,但是通过这个简单的安装脚本,它告诉我"无法创建表:eavblog_posts".

我的安装脚本是deadsimple,看起来像这样:

<?php
$installer = $this;
$installer->addEntityType('complexworld_eavblogpost',
Array(
'entity_model'=>'complexworld/eavblogpost',
'attribute_model'=>'',
'table'=>'complexworld/eavblogpost',
'increment_model'=>'',eav/entity_increment_numeric
'increment_per_store'=>'0'
));
$installer->createEntityTables(
$this->getTable('complexworld/eavblogpost')
);
Run Code Online (Sandbox Code Playgroud)

如何让我的安装脚本正常工作?这是一个已知的magento bug吗?

jml*_*nik 5

就我而言,问题是由于createEntityTables()Magento 1.7/1.12中的方法存在缺陷

他们对这个错误报告的回答中,Magento团队建议从lib/Varien/Db/Adapter/Pdo/Mysql.php中注释掉第417行:

$this->_checkDdlTransaction($sql);
Run Code Online (Sandbox Code Playgroud)

相反,我建议以下的扎卡里Schuessler的职位的建议,要么

1)将createEntityTables()方法复制到您自己的文件(您的/ Module/Model/Resource/Setup.php)并注释掉交易方法......

要么

2)编写抽象查询以保持事务:

// Example of MySQL API
/**
 * Create table array('catalog/product', 'decimal')
 */
$table = $installer->getConnection()
    ->newTable($installer->getTable(array('catalog/product', 'decimal')))
    ->addColumn('value_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
        'identity'  => true,
        'nullable'  => false,
        'primary'   => true,
        ), 'Value ID')
    ->addColumn(...
Run Code Online (Sandbox Code Playgroud)