安装程序脚本给我“实体ID错误” Magento错误

Zab*_*abs 4 magento magento-1.7

我有以下安装程序脚本-尝试运行此脚本时,出现以下Magento错误:

Error in file: "/vagrant/site.com/public_html/app/code/local/SS/Raptor/sql/raptor_setup/install-0.0.1.php" - Wrong entity ID
Run Code Online (Sandbox Code Playgroud)

我的安装脚本如下:

$installer = new Mage_Eav_Model_Entity_Setup();
$installer->startSetup();

$installer->addAttribute('customer', 'organisation_id', array(
    'input'         => 'select', //or select or whatever you like
    'type'          => 'int', //or varchar or anything you want it
    'label'         => 'Organisation ID',
    'visible'       => 1,
    'required'      => 0, //mandatory? then 1
));

$installer->addAttribute('quote', 'organisation_id', array(
    'input'         => 'select', //or select or whatever you like
    'type'          => 'int', //or varchar or anything you want it
    'label'         => 'Organisation ID',
    'visible'       => 1,
    'required'      => 0, //mandatory? then 1
));

$installer->addAttribute('order', 'organisation_id', array(
    'input'         => 'select', //or select or whatever you like
    'type'          => 'int', //or varchar or anything you want it
    'label'         => 'Organisation ID',
    'visible'       => 1,
    'required'      => 0, //mandatory? then 1
));

$installer->endSetup();
Run Code Online (Sandbox Code Playgroud)

任何想法为什么会发生这种情况?

Sim*_*n H 5

您使用了错误的安装程序类。您可以使用Mage_Customer_Model_Entity_Setup这种方式添加属性。请参阅此答案以使用Mage_Eav_Model_Entity_Setup添加客户属性

其他报价属性需要其他设置类。您可以Mage_Sales_Model_Resource_Setup在此处用作模型。