Enable it in your configuration:
stof_doctrine_extensions: orm: default: ... softdeleteable: true doctrine: ... orm: filters: softdeleteable: class: Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter enabled: true
Then in your organization:
<?php namespace Foo\BarBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; class Foo { private $deletedAt;
Then just delete objects like you, as a rule (the extension will take care of the rest):
$em = $this->getDoctrine()->getManager(); $em->remove($entity); $em->flush();
Thomas K
source share