title: Using "soft delete" with HABTM relationships in CakePHP 2
body: <p>Using HABTM tables in CakePHP 2.x, what is the best way to use a "soft delete" technique (i.e. having "deleted" boolean field within a join table) so that when removing associations the "deleted" field will only be updated to "1" instead of the row being deleted?</p>
  
  <p>An example is a database of Movies that can be part of one or more Genres. All tables have a "deleted" field so that no data is ever removed from the database, only the "deleted" field is updated to 1 or 0 as appropriate:</p>
  
  <h3>Movie</h3>
  
  <ul>
  <li>id</li>
  <li>name</li>
  <li>deleted</li>
  </ul>
  
  <h3>Genre</h3>
  
  <ul>
  <li>id</li>
  <li>name</li>
  <li>deleted</li>
  </ul>
  
  <h3>GenreMovie</h3>
  
  <ul>
  <li>genre_id</li>
  <li>movie_id</li>
  <li>deleted</li>
  </ul>
  
  <p>When adding or editing a Movie, the user can select one or more Genres to associate the Movie with. If a previously associated Genre is removed from a Movie, "deleted" would be set to "1".  If the same Genre is then re-associated with the Movie, it will be updated back to "0".</p>
  
  <p>We've tried the SoftDelete behaviour from CakeDC's Utils plugin - <a href="https://github.com/CakeDC/utils" rel="nofollow">https://github.com/CakeDC/utils</a> - which works great for Movie and Genre, but for us doesn't seem to work for the join table GenreMovie, which continues to have rows completely deleted.</p>