我正在使用推进 PHP:外键属性不依赖于父表。创建、更新、删除发生在父表中,不会影响子表。
像 onupdate、ondelete、skipsql 这样的外键元素不接受这样的推进和错误
DOMDocument::schemaValidate(): 元素'外键',属性'ondelete','onupdate','skipsql'
属性不允许?
我明白了,这是我的 xml 文件中的语法错误。
<table name="names" phpName="Name">
<column name="nameid" phpName="Nid" type="integer" size="11" required="true" primaryKey="true"
autoIncrement="true" description="Name ID"/>
<column name="name" phpName="Name" type="varchar" size="50" required="true"
description="Name"/>
<validator column="name">
<rule name="required" message="Name is Required"/>
<rule name="minLength" value="3" message="Enter Valid Full-Name, Minimum of 3 characters"/>
<rule name="maxLength" value="20" message="Invalid Entry"/>
<rule name="match" value="/^[\w]+$/" message="No Special Character Allowed"/>
<rule name="unique" />
</validator>
</table>
<table name="relations" phpName="Relations">
<column name="rid" type="integer" size="11" required="true" primaryKey="true" autoIncrement="true"
description="Relational ID"/>
<column name="pnid" type="integer" size="11" required="true" description="name User ID"/>
<column name="rnid" type="integer" size="11" required="true" description="name Relationship ID"/>
<column name="relation" type="varchar" size="100" required="true" description="Relationship"/>
<validator column="relation">
<rule name="required" message="Relationship Type is Required" />
<rule name="match" value="/^([\w])+([\.\w\-]+)+$/" message="Enter a Valid String" />
<rule name="minLength" value="3" message="Enter a Valid Relation Ship"/>
<rule name="maxLength" value="20" message="Invalid Entry"/>
</validator>
<foreign-key foreignTable="names" onUpdate="CASCADE" onDelete="CASCADE">
<reference local="pnid" foreign="nid" />
<reference local="rnid" foreign="nid" />
</foreign-key>
</table>