dropbox1111 2011-10-30 19:05
浏览 14
已采纳

Propel中不完整的关键参考是否有用?

I am using Propel to develop a system in which users can develop their own schemas, so am looking at some "edge cases". I have come across a schema that I think Propel should disallow, but it does seem to build. Can anyone suggest a use case for this?

<?xml version="1.0" encoding="UTF-8"?>
<database name="test" defaultIdMethod="native">
    <table name="test_event">
        <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
        <column name="name" type="varchar" size="50" required="true" />
        <column name="description" type="varchar" size="250" />
        <column name="location" type="varchar" size="250" />
        <column name="nearest_city" type="varchar" size="100" />
        <column name="organiser_id" type="integer" required="true" />
        <!-- This FK is incomplete -->
        <foreign-key foreignTable="test_organiser">
            <reference local="organiser_id" foreign="id" />
        </foreign-key>
    </table>

    <table name="test_organiser">
        <!-- Has composite PK -->
        <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
        <column name="secondary" type="integer" required="true" primaryKey="true" />
        <column name="name" type="varchar" size="50" required="true" />     
        <column name="email" type="varchar" size="100" />
    </table>
</database>

As you can see, the event table has an incomplete foreign reference to the organiser table. I'd have thought Propel would have detected that and kicked it out at build time - but apparently not! I can't see why this would be useful - the setTestOrganiser and getTestOrganiser methods in BaseTestEvent only refer to one part of the composite PK (because, of course, the event side is only aware of the organiser_id part).

Propel 1.6.1, PHP 5.2.17.

  • 写回答

1条回答 默认 最新

  • duanluanlang8501 2014-07-27 01:01
    关注

    No they're not useful. Propel does just not have a check for this use case at the moment. I've created a issue for it so you won't stumble over it again when we've implemented it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的