Doctrine Blameable: on = "change" does not work during on = "create" and "update" do

I am trying to combine the Doctrine Blameable and Softdeleteable extensions: when I execute $em->remove($myEntity);, I want to update the fields deletedand accordingly deletedBy.

use Gedmo\Mapping\Annotation as Gedmo;

/**
 * @Gedmo\SoftDeleteable(fieldName="deleted", timeAware=false)
 */

[...]

/**
 * DateTime of softdeletion
 * @var \DateTime
 * 
 * @ORM\Column(name="deleted", type="datetime", nullable=true)
 * @Assert\DateTime()
 */
private $deleted;

/**
 * Softdeleted by
 * @var MyProject\UserBundle\Entity\User $deletedBy
 *
 * @Gedmo\Blameable(on="change", field="deleted")
 * @ORM\ManyToOne(targetEntity="MyProject\UserBundle\Entity\User")
 * @ORM\JoinColumn()
 */
private $deletedBy;

I have a similar configuration for created / createdBy (with Blameable(on="create")) and updated / updated By (with Blameable(on="update")).

Even stranger, if I replaced the code above with the one below, the field deletedBywill be updated correctly:

/**
 * Softdeleted by
 * @var MyProject\UserBundle\Entity\User $deletedBy
 *
 * @Gedmo\Blameable(on="update")
 * @ORM\ManyToOne(targetEntity="MyProject\UserBundle\Entity\User")
 * @ORM\JoinColumn()
 */
private $deletedBy;

So it seems that only the part is Blameable(on="change", field="deleted")not working, and I have no idea why ...

+4
source share

All Articles