문제

I have recently got an assignment from my school, where I have to create a Propel Schema for ORM. This isn't really a Problem, but one of the requirements is to connect two of those tables with a many-to-many relationship.

Normally, you would do that with a crosstable (holding the attributes from both tables), but our teacher said that this is also possible WITHOUT such a crosstable (and even is a requirement).

How would one go into creating such in Propel?

The ERD in Question:

http://files.f-o-g.eu/b8f8a9

(I am stuck at VIP <-> Einladung)

So far I have this:

<?xml version="1.0" encoding="UTF-8"?>
<database name="orm1" defaultIdMethod="native">
    <table name="einladung" phpName="Einladung">
            <column name="nummer" type="INTEGER" primaryKey="true" autoIncrement="true" />
            <column name="fbuffet" type="BOOLEAN" />
            <column name="splatz" type="INTEGER" />
    </table>
    <table name="sorganisation" phpName="SpendenOrganisation">
            <column name="name" type="VARCHAR" size="255" primaryKey="true" required="true" />
            <column name="adresse" type="VARCHAR" size="255" />
    </table>
    <table name="wveranstaltung" phpName="WVeranstaltung">
            <column name="titel" type="VARCHAR" size="255" primaryKey="true" required="true" />
            <column name="datum" type="DATE" required="true" />
            <column name="ort" type="VARCHAR" size="255"/>

    </table>
    <table name="vip" phpName="Vip">
            <column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
            <column name="vname" type="VARCHAR" size="255" required="true" />
            <column name="nname" type="VARCHAR" size="255" required="true" />
    </table>
</database>

Anyone got a clue?

도움이 되었습니까?

해결책

It is not possible to create a m-to-m relation without a cross table.

I guess your VIP -> Einladung relation is just wrong. It should probably be a 1-to-n relation.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top