在我的数据库中,我有一个user
表。这个用户表有几个字段,其中parent_user_id
和user_class_id
,都是外键,它们都不是主键的一部分。在我的 BaseUser.php 中,它列出了如下的外键:
protected $aUserRelatedByUserParentId;
protected $aUserClass;
同样,我有getUserClass()
andsetUserClass()
但我没有getUserParent()
and setUserParent()
。相反,我有getUserParentId() and setUserParentId()
. 这是否有原因,如果有,我可以在 schema.xml 中覆盖它吗?这里是:
<?xml version="1.0" encoding="utf-8"?>
<!--Autogenerated by PropelSchemaReverseTask class.-->
<database name="test" defaultIdMethod="native">
<table name="user" phpName="User" idMethod="native">
<column name="id" phpName="Id" type="INTEGER" primaryKey="true" required="true"/>
<column name="parent_user_id" phpName="ParentUserId" type="INTEGER" required="true"/>
<column name="name" phpName="Name" type="VARCHAR" size="45" required="true"/>
<column name="description" phpName="Description" type="VARCHAR" size="45" required="true"/>
<column name="user_class_id" phpName="UserClassId" type="INTEGER" required="true"/>
<foreign-key foreignTable="user_class" name="fk_user_class">
<reference local="user_class_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="user" name="fk_user_parent">
<reference local="parent_user_id" foreign="id"/>
</foreign-key>
<index name="fk_user_parent_idx">
<index-column name="parent_user_id"/>
</index>
<index name="fk_user_class_idx">
<index-column name="user_class_id"/>
</index>
<vendor type="mysql">
<parameter name="Engine" value="InnoDB"/>
</vendor>
</table>
<table name="user_class" phpName="UserClass" idMethod="native">
<column name="id" phpName="Id" type="INTEGER" primaryKey="true" required="true"/>
<column name="name" phpName="Name" type="VARCHAR" size="45" required="true"/>
<column name="permissions" phpName="Permissions" type="VARCHAR" size="45" required="true"/>
<vendor type="mysql">
<parameter name="Engine" value="InnoDB"/>
</vendor>
</table>
</database>