public function __construct($user) { $this->user = $user; if ($user->isNew()) { $this->user->setSalt(base_convert(sha1(uniqid(mt_rand(), true)), 16, 36)); $this->setEnabled(false); $this->setCredentialsExpired(false); $this->setLocked(false); $this->setExpired(false); $this->user->setRoles(array()); } }