gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 00:34:37 25 4
gpt4 key购买 nike

我正在尝试在 Magento 1.7.0.0 中设置自定义实体,遵循 alan storms article about it ,但是使用这个简单的安装脚本,它告诉我“无法创建表:eavblog_posts”。

我的安装脚本很简单,看起来像这样:

<?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')
);

我怎样才能让我的安装脚本工作?这是一个已知的 magento 错误吗?

最佳答案

在我的情况下,问题是由于 createEntityTables() 的错误引起的。 Magento 1.7/1.12 中的方法

their answer to this bug report ,Magento 团队建议从 lib/Varien/Db/Adapter/Pdo/Mysql.php 中注释掉第 417 行:

$this->_checkDdlTransaction($sql);

相反,我建议关注 the advice in Zachary Schuessler's post并且要么

1) 复制 createEntityTables()方法到您自己的文件(Your/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(...

关于Magento eav 实体设置失败 - 无法创建表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10491912/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com