@Ken Hannelによる以前の回答後の私の古い解決策は次のとおりです。
編集: /vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php
walkDeleteClause 関数を次のように置き換えます。
public function walkDeleteClause(AST\DeleteClause $deleteClause)
{
$class = $this->em->getClassMetadata($deleteClause->abstractSchemaName);
$tableName = $class->getTableName();
$sql = 'DELETE FROM ' . $this->quoteStrategy->getTableName($class, $this->platform);
$this->setSQLTableAlias($tableName, $tableName, $deleteClause->aliasIdentificationVariable);
$this->rootAliases[] = $deleteClause->aliasIdentificationVariable;
//check if SoftDeleteableListener is attached
foreach ($this->em->getEventManager()->getListeners() as $eventName => $listeners) {
foreach ($listeners as $listener) {
if ($listener instanceof \Gedmo\SoftDeleteable\SoftDeleteableListener) {
$date = date('Y-m-d H:i:s');
$sql = 'UPDATE ' . $this->quoteStrategy->getTableName($class, $this->platform) . " SET deletedAt = ' " . $date . " ' ";
}
}
}
return $sql;
}
でも本当に、ケン・ハネルのやり方はよりプロフェッショナルで標準的だと思います。