非常に単純なPropelの質問があります。リードをデータベースに保存しています。これらのリードには、1 つ以上のコミュニティへの関心があります。私が使用しているテーブルには、「lead」、「community」、および「lead_communities」結合テーブルという名前が付けられています。見込み客のコミュニティへの関心をすべて削除する最善の方法は?
ここにいくつかの詳細があります。Propel スキーマは次のようになります。
<table name="community">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
<column name="name" type="VARCHAR" size="255" />
<column name="address" type="VARCHAR" size="255" />
etc...
<table name="lead_communities">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true"/>
<column name="lead_id" type="INTEGER" />
<column name="community_id" type="INTEGER" />
<column name="created_date" type="DATE" size="4" />
<foreign-key foreignTable="community" refPhpName="Lead_Communities">
<reference local="community_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="lead" refPhpName="Lead_Communities">
<reference local="lead_id" foreign="id"/>
</foreign-key>
</table>
<table name="lead">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true"/>
<column name="salutation" type="VARCHAR" size="20" />
<column name="first_name" type="VARCHAR" size="255" defaultValue="" />
<column name="last_name" type="VARCHAR" size="255" defaultValue="" />
<column name="email" type="VARCHAR" size="255" defaultValue="" />
etc..
データベースからリードを選択する方法は次のとおりです。
$lead = LeadQuery::create()->filterByEmail($enauk)->findOne();
だから、私がやりたいことは次のようなものです:
$lead->deleteLeadCommunities();