I think I'll go to Zed, but for completeness:
The event listener method for deletion (and selection) for soft deletion behavior contains:
if ( ! $query->contains($field)) {
This means that if you explicitly specify a field in the request, it will not apply to the request.
So if you do this:
$q = Doctrine_Query::create() ->delete('Table t') ->where('t.id = ? AND t.deleted != 2 ', 1);
he will not apply soft deletion materials and will actually delete the record. Note that you can do anything with t.deleted, I just did something that will always be true. An alias (βt.β) Is also important for its operation.
This trick also works for the choice in which I used to use it before.
As I said, I think itβs better to do it:
$old_dqlc = Doctrine_Manager::getInstance()->getAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS); Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS, false); $record->delete(); Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS, $old_dqlc);
In particular, you can still use the delete () method, rather than manually create a query. One plus for the query method is that if you have other behaviors attached to the record, they will still be respected.
benlumley
source share