X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/ea9b00a8025f8bbe7a1c28399f7538bea6d60a2c..d9759a7dc84c98e916ae1f89d7542ddc966ccb70:/Entity/Group.php

diff --git a/Entity/Group.php b/Entity/Group.php
index 188e1bc..aa60f77 100644
--- a/Entity/Group.php
+++ b/Entity/Group.php
@@ -1,7 +1,7 @@
 <?php declare(strict_types=1);
 
 /*
- * This file is part of the Rapsys PackBundle package.
+ * This file is part of the Rapsys UserBundle package.
  *
  * (c) Raphaël Gertz <symfony@rapsys.eu>
  *
@@ -51,7 +51,10 @@ class Group {
 	 * @param string $title The group name
 	 */
 	public function __construct(string $title) {
+		//Set defaults
 		$this->title = $title;
+		$this->created = new \DateTime('now');
+		$this->updated = new \DateTime('now');
 		$this->users = new ArrayCollection();
 	}
 
@@ -166,7 +169,7 @@ class Group {
 	 */
 	public function preUpdate(PreUpdateEventArgs $eventArgs) {
 		//Check that we have a group instance
-		if (($user = $eventArgs->getEntity()) instanceof Group) {
+		if (($user = $eventArgs->getObject()) instanceof Group) {
 			//Set updated value
 			$user->setUpdated(new \DateTime('now'));
 		}
@@ -187,6 +190,7 @@ class Group {
 	 * @return string
 	 */
 	public function getRole(): string {
+		//XXX: $prefix = 'ROLE_' set in Role*Voter classes
 		return 'ROLE_'.strtoupper($this->title);
 	}
 }