예제 #1
0
 /**
  * Get Email address of a user; fallback to contact / account if not defined
  *
  * @param UserInterface $user
  * @param bool $useFallback
  *
  * @return null|string
  */
 public function getEmailAddressOfUser(UserInterface $user, $useFallback = true)
 {
     // take users email address
     $userEmail = $user->getEmail();
     if ($userEmail) {
         return $userEmail;
     }
     // fallback: get contacts / accounts main-email
     $contact = $user->getContact();
     if ($useFallback && $contact) {
         return $this->getEmailAddressOfContact($contact);
     }
     return null;
 }