gpt4 book ai didi

symfony1 - ATTR_AUTO_ACCESSOR_OVERRIDE

转载 作者:行者123 更新时间:2023-12-04 19:17:45 25 4
gpt4 key购买 nike

我在构建模型时收到此错误消息:

When using the attribute ATTR_AUTO_ACCESSOR_OVERRIDE you cannot use the field name "attribute" ...

问题是,我必须使用这个字段名称,因为它在一个由美德创建和使用的表中。别名也不起作用。
product_attribute: { name: product_attribute as attribute,  type: clob(16777777) }

那么,我能做什么?可以转吗 ATTR_AUTO_ACCESSOR_OVERRIDE关闭或我有问题。如果可以,我该怎么做?

会不会是车削有问题 ATTR_AUTO_ACCESSOR_OVERRIDE离开?如果有一个(或多个),它会是什么?

我很感激任何建议!

附加信息:

BaseJosVmProduct 中的定义: @property clob $product_attribute
架构.yml:
JosVmProduct:
columns:
product_id: { type: int, notnull: true, unique: true, primary: true, autoincrement: true }
vendor_id: { type: int, notnull: true, default: 0 }
product_parent_id: { type: int, notnull: true, default: 0 }
product_sku: { type: string(64), , notnull: true, default: '' }
product_s_desc: { type: string(255), default: null }
product_desc: { type: clob(16777777) }
product_thumb_image: { type: string(255), default: null }
product_full_image: { type: string(255), default: null }
product_publish: { type: string(1), default: null }
product_weight: { type: decimal(10), scale: 4, default: null }
product_weight_uom: { type: string(32), default: 'pounds.' }
product_length: { type: decimal(10), scale: 4, default: null }
product_width: { type: decimal(10), scale: 4, default: null }
product_height: { type: decimal(10), scale: 4, default: null }
product_lwh_uom: { type: string(32), default: 'inches' }
product_url: { type: string(255), default: null }
product_in_stock: { type: int, default: null }
product_available_date: { type: int, default: null }
product_availability: { type: string(56), notnull: true, default: '' }
product_special: { type: string(1), default: null }
product_discount_id: { type: int, default: null }
ship_code_id: { type: int, default: null }
cdate: { type: int, default: null }
mdate: { type: int, default: null }
product_name: { type: string(64), default: null }
product_sales: { type: int, notnull: true, default 0 }
product_attribute: { name: product_attribute as attribute, type: clob(16777777) }
custom_attribute: { type: clob(16777777), notnull: true }
product_tax_id: { type: int(2), notnull: true, default: '0' }
product_unit: { type: string(32), default: null }
product_packaging: { type: int, default: null }
webinar_duration: { type: string(50), default: null }

最佳答案

我找到了更好的解决方案,把它放在 ProjectConfiguration 类中:

public function configureDoctrine()
{
$isCli = (php_sapi_name() == "cli");
if(true == $isCli)
{
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, false);
}
}

自动检测 CLI 上下文并关闭适当的 ATTR。

关于symfony1 - ATTR_AUTO_ACCESSOR_OVERRIDE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7266293/

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