本文整理汇总了PHP中FOS\UserBundle\Model\UserInterface类的典型用法代码示例。如果您正苦于以下问题:PHP UserInterface类的具体用法?PHP UserInterface怎么用?PHP UserInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserInterface类的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: onSuccess
protected function onSuccess(UserInterface $user)
{
$user->setPlainPassword($this->getNewPassword());
$user->setConfirmationToken(null);
$user->setEnabled(true);
$this->userManager->updateUser($user);
}
示例3: 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());
}
示例4: onSuccess
protected function onSuccess(UserInterface $user, $confirmation)
{
$user->setPasskey(md5(uniqid()));
$user->setDateAdded(new \DateTime('now'));
$user->setLastActivity(new \DateTime('now'));
parent::onSuccess($user, $confirmation);
}
示例5: 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());
}
示例6: 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());
}
示例7: reloadUser
/**
* {@inheritDoc}
*/
public function reloadUser(UserInterface $user)
{
if (!$user instanceof \Persistent) {
throw new \InvalidArgumentException('This user instance is not supported by the Propel UserManager implementation');
}
$user->reload();
}
示例8: 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());
}
示例9: onSuccess
/**
* @param UserInterface $user
*/
protected function onSuccess(UserInterface $user)
{
if ($this->getNewPassword() != "") {
$user->setPlainPassword($this->getNewPassword());
}
$this->userManager->updateUser($user);
}
示例10: 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);
}
示例11: 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());
}
示例12: 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());
}
示例13: 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());
}
示例14: storeDateTimeSettingsInSession
/**
* Make user date and time settings sticky
*
* @param UserInterface $user
* @param SessionInterface $session
*/
protected function storeDateTimeSettingsInSession(UserInterface $user, SessionInterface $session)
{
$session->set('campaignchain.locale', $user->getLocale());
$session->set('campaignchain.timezone', $user->getTimezone());
$session->set('campaignchain.dateFormat', $user->getDateFormat());
$session->set('campaignchain.timeFormat', $user->getTimeFormat());
}
示例15: getPrincipalArray
/**
* get Array with Principal-Data from User-Object.
*
* @param UserInterface|GroupInterface $principalObject
* @param bool $show_id
*
* @return array
*
* @throws Exception
*/
private function getPrincipalArray($principalObject, $show_id = false)
{
if (!$principalObject instanceof UserInterface && !$principalObject instanceof GroupInterface) {
throw new Exception('$principalObject must be of type UserInterface of GroupInterface');
}
$principal = array();
if ($show_id) {
$principal['id'] = $principalObject->getId();
}
if ($principalObject instanceof UserInterface) {
$principal['uri'] = 'principals/' . $principalObject->getUsername();
} else {
$principal['uri'] = 'principals/' . $principalObject->getName();
}
// get all fields from $this->fieldMap, additional to 'uri' and 'id'
foreach ($this->fieldMap as $key => $value) {
if (!method_exists($principalObject, $value['getter'])) {
continue;
}
$valueGetter = call_user_func(array($principalObject, $value['getter']));
if ($valueGetter) {
$principal[$key] = $valueGetter;
}
}
return $principal;
}