silverstripe/sapphire — pull request #1245 by ajshort (2013-02-28 10:35:42+00:00)
Title: Fix ManyManyList#removeAll With Filters

Currently if you do:

$this->ManyMany()->filter(...)->removeAll()

it will fail, as the fields referenced by the filter are removed by the custom query mangling. This is solved in two parts:

* Allow setting a table target to delete with `SQLQuery#setDelete()`.
* Use the original query in remove all, just set it to delete form the join table.