X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/c10ada0bebaf63162b0db1866f643984bdadbb30..dedb94306e39d1d64f8b970a366a16cfb68c16dc:/Entity/Group.php diff --git a/Entity/Group.php b/Entity/Group.php index d7ca3c7..188e1bc 100644 --- a/Entity/Group.php +++ b/Entity/Group.php @@ -12,6 +12,7 @@ namespace Rapsys\UserBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\ORM\Event\PreUpdateEventArgs; use Rapsys\UserBundle\Entity\User; @@ -160,6 +161,17 @@ class Group { return $this->users; } + /** + * {@inheritdoc} + */ + public function preUpdate(PreUpdateEventArgs $eventArgs) { + //Check that we have a group instance + if (($user = $eventArgs->getEntity()) instanceof Group) { + //Set updated value + $user->setUpdated(new \DateTime('now')); + } + } + /** * Returns a string representation of the group *