我在第三方数据库中有一个名为“deleted”的列名称(我无法更改)。 当我使用 propel 生成对象模型时,它会生成一个带有名为“$deleted”属性的基类供其自己使用。然后它将我的“已删除”列添加为也称为“$deleted”的属性。 当尝试执行查询时,它会提示“无法重新声明 Base\myClass::$deleted”。如何阻止 propel 生成具有与数据库列同名属性的 Base 对象?有没有办法在 schema.xml 中做到这一点?我尝试使用 phpNamingMethod 属性,但这仅更改方法名称,而不更改成员变量。
这是由每个基础对象上的 propel 生成的:
/**
* attribute to determine whether this object has been deleted.
* @var boolean
*/
protected $deleted = false;
这是从我的 schema.xml 文件生成的:
/**
* The value for the deleted field.
* @var int
*/
protected $deleted;
最佳答案
只需定义另一个 phpName。
<column name="deleted" phpName="otherDeleteName" type="boolean" />
关于php - Propel ORM,列名为 "deleted",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25860795/