+
+ /**
+ * Check if account is enabled
+ *
+ * @see vendor/symfony/security-core/User/InMemoryUserChecker.php
+ */
+ public function isEnabled(): bool {
+ return $this->enable;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function preUpdate(PreUpdateEventArgs $eventArgs) {
+ //Check that we have an user instance
+ if (($user = $eventArgs->getObject()) instanceof User) {
+ //Set updated value
+ $user->setUpdated(new \DateTime('now'));
+ }
+ }
+
+ /**
+ * Returns a recipient name of the user
+ *
+ * @return string
+ */
+ public function getRecipientName(): string {
+ //Without forename and surname
+ if (empty($this->forename) && empty($this->surname)) {
+ //Return recipient name from mail
+ return ucwords(trim(preg_replace('/[^a-zA-Z]+/', ' ', current(explode('@', $this->mail)))));
+ }
+
+ //Return recipient name from forename and surname
+ return implode(' ', [$this->forename, $this->surname]);
+ }
+
+ /**
+ * Returns a string representation of the user
+ *
+ * @return string
+ */
+ public function __toString(): string {
+ return $this->civility.' '.$this->forename.' '.$this->surname;
+ }