-1

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.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

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.

Marc J. Schmidt
  • 8,302
  • 4
  • 34
  • 33
  • Thanks Marc, appreciated. I'd have created a ticket myself, but wanted to check first. – halfer Jul 27 '14 at 09:36
  • Hi Marc, a quick off-topic. What is the state of Propel2 at the moment? I am seeing a fairly regular stream of commits this year, so I assume people are using it and find it useful already. Might another alpha or a beta come out soon? – halfer Jul 17 '16 at 11:22
  • @halfer yeah another version is probably a good idea as many people use it. Unfortunately less time currently :( – Marc J. Schmidt Jul 18 '16 at 15:03
  • Great, I'll look forward to that Marc! – halfer Jul 18 '16 at 15:10