我在安装程序脚本中有以下代码&现在需要通过安装程序脚本删除is_school属性,我的代码是否正确?通过安装程序脚本删除Magento中的自定义属性
// code within existing installer script (this works fine)
$installer->addAttribute("customer", "is_school", array(
"type" => "int",
"backend" => "",
"label" => "Is School?",
"input" => "int",
"source" => "",
"visible" => false,
"required" => false,
"default" => "",
"frontend" => "",
"unique" => false,
"note" => ""
));
我打算删除属性 - 这看起来是否正确?
$installer->startSetup();
$installer->removeAttribute('customer', 'is_school');
$installer->endSetup();
删除属性时是否还有其他要求?
如果'$ installer'是'Mage_Eav_Model_Entity_Setup'的一个实例,'customer'是添加了'is_school'的唯一实体,那么您的删除脚本应该可以正常工作。 –