本文整理汇总了PHP中FOS\UserBundle\Model\UserInterface::getEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP UserInterface::getEmail方法的具体用法?PHP UserInterface::getEmail怎么用?PHP UserInterface::getEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FOS\UserBundle\Model\UserInterface
的用法示例。
在下文中一共展示了UserInterface::getEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmailMessage
public function sendEmailMessage(UserInterface $user)
{
$template = $this->parameters['template']['new'];
$url = $this->router->generate('fos_user_registration_confirm_email', ['token' => $user->getConfirmationToken(), 'email' => $user->getEmail()], true);
$context = ['user' => $user, 'confirmationUrl' => $url];
$this->sendMessage($template, $context, $this->parameters['from_email']['confirmation'], $user->getEmail());
}
示例2: updateUser
/**
* {@inheritdoc}
*/
public function updateUser(UserInterface $user, $andFlush = true)
{
// Extract email part before the `@` character to use it as username is username not set
if (null === $user->getUsername()) {
$user->setUsername(substr($user->getEmail(), 0, strpos($user->getEmail(), '@')));
}
// Call parent after as does not override parent and parent do the flush
parent::updateUser($user, $andFlush);
}
示例3: sendResettingEmailMessage
public function sendResettingEmailMessage(UserInterface $user)
{
$template = $this->getTemplate('resetting');
$url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
$context = array('user' => $user, 'confirmationUrl' => $url);
return $this->sendMessage($template, $context, $this->getFromEmail('resetting'), $user->getEmail());
}
示例4: sendResettingEmailMessage
public function sendResettingEmailMessage(UserInterface $user)
{
$template = $this->parameters['template']['resetting'];
$url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), UrlGeneratorInterface::ABSOLUTE_URL);
$context = array('user' => $user, 'confirmationUrl' => $url);
$this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], $user->getEmail());
}
示例5: sendMail
/**
* @param UserInterface $user
* @param string $subject
* @param string $body
*/
private function sendMail(UserInterface $user, $subject, $body)
{
$message = $this->mailer->createMessage();
$to = array($user->getEmail() => $user->getUsername());
$message = $message->setSubject($subject)->addFrom($this->mailSender, $this->mailSenderName)->setTo($to)->setBody($body, 'text/html');
$this->mailer->send($message);
}
示例6: sendCreationEmailMessage
/**
* {@inheritdoc}
*/
public function sendCreationEmailMessage(UserInterface $user)
{
$template = $this->parameters['creation.template'];
$url = $this->router->generate('fos_user_registration_confirm', array('token' => $user->getConfirmationToken()), UrlGeneratorInterface::ABSOLUTE_URL);
$rendered = $this->templating->render($template, array('user' => $user, 'password' => $user->getPlainPassword(), 'confirmationUrl' => $url));
$this->sendEmailMessage($rendered, $this->parameters['from_email']['creation'], $user->getEmail());
}
示例7: sendResettingEmailMessage
public function sendResettingEmailMessage(UserInterface $user)
{
$template = $this->parameters['template']['resetting'];
$url = $this->router->generate('get_reset_resetting', array('token' => $user->getConfirmationToken()), true);
$context = array('user' => $user, 'confirmationUrl' => str_replace('api', '#', $url));
$this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], $user->getEmail());
}
示例8: sendInvitationEmail
/**
* {@inheritdoc}
*/
public function sendInvitationEmail(UserInterface $user)
{
$template = $this->parameters['invitation.template'];
$url = $this->router->generate('kreta_user_registration', ['token' => $user->getConfirmationToken()], true);
$rendered = $this->templating->render($template, ['user' => $user, 'registerUrl' => $url]);
$this->sendEmailMessage($rendered, self::KRETA_INVITATION_EMAIL, $user->getEmail());
}
示例9: sendResettingEmailMessage
public function sendResettingEmailMessage(UserInterface $user, $engine)
{
$template = $this->parameters['resetting_password.template'];
$url = $this->router->generate('fos_user_user_reset_password', array('token' => $user->getConfirmationToken()), true);
$rendered = $this->templating->render($template . '.txt.' . $engine, array('user' => $user, 'confirmationUrl' => $url));
$this->sendEmailMessage($rendered, $this->getSenderEmail('resetting_password'), $user->getEmail());
}
示例10: sendConfirmationEmailMessage
public function sendConfirmationEmailMessage(UserInterface $user)
{
$template = $this->parameters['confirmation.template'];
$url = $this->router->generate('fos_user_registration_confirm', array('token' => $user->getConfirmationToken()), true);
$rendered = $this->templating->render($template, array('user' => $user, 'confirmationUrl' => str_replace('%23', '#', $url)));
$this->sendEmailMessage($rendered, $this->parameters['from_email']['confirmation'], $user->getEmail());
}
示例11: sendResettingEmailMessage
public function sendResettingEmailMessage(UserInterface $user)
{
$template = $this->parameters['resetting.template'];
$url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
$rendered = $this->templating->render($template, array('user' => $user, 'confirmationUrl' => $url));
$this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], $user->getEmail());
}
示例12: withEntity
/**
* @param UserInterface $user
* @return UserDTO
*/
public static function withEntity(UserInterface $user)
{
$dto = new UserDTO();
$dto->setId($user->getId());
$dto->setEmail($user->getEmail());
$dto->setApiKey($user->getApiKey());
return $dto;
}
示例13: sendResettingEmailMessage
/**
* Override for change resetting url
* {@inheritdoc}
*/
public function sendResettingEmailMessage(UserInterface $user)
{
$template = $this->parameters['resetting.template'];
$resetLink = $this->parameters['password_resetting_link'];
$url = $resetLink . '/' . $user->getConfirmationToken();
$rendered = $this->templating->render($template, array('user' => $user, 'confirmationUrl' => $url));
$this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], $user->getEmail());
}
示例14: sendResettingEmailMessage
/**
* {@inheritdoc}
*/
public function sendResettingEmailMessage(UserInterface $user)
{
$url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
$subject = $this->translate('resetting.email.subject', $user->getUsername(), $url);
$body = $this->translate('resetting.email.message', $user->getUsername(), $url);
$rendered = $this->templating->render('@App/Utils/email_structure.html.twig', array('body' => $body));
$this->sendEmailMessage($rendered, $subject, $this->parameters['from_email']['resetting'], $user->getEmail());
}
示例15: getObfuscatedEmail
/**
* Get the truncated email displayed when requesting the resetting.
*
* The default implementation only keeps the part following @ in the address.
*
* @param \FOS\UserBundle\Model\UserInterface $user
*
* @return string
*/
protected function getObfuscatedEmail(UserInterface $user)
{
$email = $user->getEmail();
if (false !== ($pos = strpos($email, '@'))) {
$email = '...' . substr($email, $pos);
}
return $email;
}