This question already has an answer here:
I'm expecting, it should update deleted_at field when I've executed DELETE
query. And it should add deleted_at is null
condition to end of SELECT query. But its really delete rows with a silly condition. What is wrong?
$query = $this->entityManager->createQueryBuilder()
->delete("AppBundle:ReportRow", "r")
->where("r.date <= :date")
->andWhere("r.balance is null")
->andWhere("r.name = :name")
->setParameters(array("date" => $date->format("Y-m-d"),
"name" => $user->getName()))
->getQuery();
$output->writeln($query->getSQL());
Here is the output:
DELETE FROM report_row
WHERE (date <= ? AND balance_id IS NULL AND name = ?)
AND (report_row.deleted_at IS NULL) // really ?? its delete query dude!
Here is my configuration
doctrine:
...
orm:
...
filters:
softdeleteable:
class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter
enabled: true
stof_doctrine_extensions:
orm:
default:
softdeleteable: true
</div>