<?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>
*
* @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();
}
*/
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'));
}
* @return string
*/
public function getRole(): string {
+ //XXX: $prefix = 'ROLE_' set in Role*Voter classes
return 'ROLE_'.strtoupper($this->title);
}
}