は基本的に、私はNを持っています。 Plans and SusciationプライマリキーはこのN:M関係の主キーであり、このN:M関係も「価格」属性を有する。 私は、この表の価格の属性を更新する必要があるので、私はPropelのことで生成されたクラスでそれにアクセスする方法を見つけ出すことはできません。 私が見てきたように、PlanクラスとSubscriptionクラスには、私が必要なことをするための方法がないようです。私はPropelの上にいくつかのものをコーディングする必要がある場合があります、私はそのことを考えていたPropelによって生成されたCrossRefテーブルのプライマリキー以外の値にどのようにアクセスできますか? (「計画」と「サブスクリプション」テーブル間の)Mの関係:
これは、これらのツリーの関係(計画、サブスクリプションおよびそのCrossRefの)宣言されている私のschema.xmlの一部である
<table name="subscriptions" phpName="Subscription">
<column name="id_subscription" type="integer" required="true" primaryKey="true" autoIncrement="true"/>
<column name="name" type="varchar" required="true"/>
<column name="description" type="longvarchar" required="true"/>
</table>
<table name="planes_subscriptions" isCrossRef="true">
<column name="id_plan" type="integer" primaryKey="true"/>
<column name="id_subscription" type="integer" primaryKey="true"/>
<column name="price" type="real"/>
<foreign-key foreignTable="planes" onDelete="CASCADE" onUpdate="CASCADE">
<reference local="id_plan" foreign="id_plan"/>
</foreign-key>
<foreign-key foreignTable="subscriptions" onDelete="CASCADE" onUpdate="CASCADE">
<reference local="id_subscription" foreign="id_subscription"/>
</foreign-key>
</table>
<table name="planes" phpName="Plan">
<column name="id_plan" type="integer" required="true" primaryKey="true" autoIncrement="true"/>
<column name="name" type="varchar" required="true"/>
<column name="description" type="longvarchar" required="false"/>
<column name="price" type="real" required="true"/>
</table>
は、クラスを生成しましたそのためには、私はどのようにプライマリキーでこのテーブルの行にアクセスするかを理解することはできません。
私はPropelのドキュメントに研究してきましたが、彼らはちょうどこの特定のケース扱いません:それは夜(実際には夜明け - 朝)だけの問題だった
Blog: Many-to-many Relationships: Check!