\User\Notification\MessagePasswordRequestMessage

Sends instructions for the "password recovery" process.

Summary

Methods
Properties
Constants
send()
__construct()
subject()
body()
$Users
No constants found
_parseVariables()
$_defaultConfig
$_user
$_subject
$_body
N/A
No private methods found
No private properties found
N/A

Properties

$Users

$Users : \User\Model\Table\UsersTable

Type

\User\Model\Table\UsersTable

$_defaultConfig

$_defaultConfig : array

Default configuration.

Options:

  • updateToken: Whether to update user's token before any message is sent, defaults to true.

  • emailConfig: Name of the transport configuration to use when sending emails. This can be define in site's "settings.php" file. Defaults to default.

Type

array

$_subject

$_subject : string

Message's subject.

Type

string

$_body

$_body : string

Message's body.

Type

string

Methods

send()

send() : boolean

Sends email message to user.

Throws

\BadMethodCallException

When "name" or "email" properties are missing for the provided User entity

Returns

boolean —

True on success, false otherwise

__construct()

__construct(\User\Model\Entity\User $user, array $config)

Message constructor.

Parameters

\User\Model\Entity\User $user

The user for which send this message

array $config

Options for message sender

subject()

subject(string $subject) : $this|string

Gets or sets message's subject.

Parameters

string $subject

Subject

Returns

$this|string —

When new value is set, $this is returned for allowing method chaining. When getting value a string will be returned

body()

body(string $body) : $this|string

Gets or sets message's body.

Parameters

string $body

Body

Returns

$this|string —

When new value is set, $this is returned for allowing method chaining. When getting value a string will be returned

_parseVariables()

_parseVariables(string $text) : string

Looks for variables tags in the given message and replaces with their corresponding values. For example, "{{site:name}} will be replaced with user's real name.

Message classes can overwrite this method and add their own logic for parsing variables.

Parameters

string $text

Message where to look for tags.

Returns

string