title: Using the Propel ORM, how would one delete all related records of an object?
body: <p>I have a pretty simple Propel question.  I'm storing leads in a database.  Those leads have one or more community interests.  The tables I'm using are named, 'lead', 'community', and a 'lead_communities' join table.  What's the best way to delete all of a lead's community interests?</p>
  
  <p>Here are some more details.  The Propel schema looks like this:</p>
  
  <pre><code>    &lt;table name="community"&gt;
        &lt;column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" /&gt;
        &lt;column name="name" type="VARCHAR" size="255" /&gt;
        &lt;column name="address" type="VARCHAR" size="255" /&gt;
        etc...
  
  
      &lt;table name="lead_communities"&gt;
        &lt;column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true"/&gt;
        &lt;column name="lead_id" type="INTEGER" /&gt;
        &lt;column name="community_id" type="INTEGER" /&gt;
        &lt;column name="created_date" type="DATE" size="4" /&gt;
        &lt;foreign-key foreignTable="community" refPhpName="Lead_Communities"&gt;
          &lt;reference local="community_id" foreign="id"/&gt;
        &lt;/foreign-key&gt;
        &lt;foreign-key foreignTable="lead" refPhpName="Lead_Communities"&gt;
          &lt;reference local="lead_id" foreign="id"/&gt;
        &lt;/foreign-key&gt;      
      &lt;/table&gt;  
  
      &lt;table name="lead"&gt;
        &lt;column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true"/&gt;
        &lt;column name="salutation" type="VARCHAR" size="20" /&gt;
        &lt;column name="first_name" type="VARCHAR" size="255" defaultValue="" /&gt;
        &lt;column name="last_name" type="VARCHAR" size="255" defaultValue="" /&gt;
        &lt;column name="email" type="VARCHAR" size="255" defaultValue="" /&gt;
        etc..
  </code></pre>
  
  <p>Here's how I select the lead from the database:</p>
  
  <pre><code>$lead = LeadQuery::create()-&gt;filterByEmail($enauk)-&gt;findOne();
  </code></pre>
  
  <p>So, what I hope to do is something like:</p>
  
  <pre><code>$lead-&gt;deleteLeadCommunities();
  </code></pre>