Skip to main content

GravityKit\GravityMigrate\Schema\Recipient

Who a notification goes to, which is one of three different things.

A form can mail a fixed address, or mail whatever address the submitter typed into a field, or pick the address by a rule: sales for one answer, support for another. Every platform offers some of the three and stores them differently.

A caller has to ask which kind it is before reading it. A routing recipient read as an address sends nothing to nobody, and the form still saves.

Since: %ver%

Source: src/Schema/Recipient.php:22

Details

  • Kind: class
  • Namespace: GravityKit\GravityMigrate\Schema

Methods

MethodDescription
to_array()The recipient as plain data.
from_array()Reads a recipient back.
addresses()A fixed list of addresses.
field()Whatever address the submitter entered in a field.
routing()An address chosen by rule.
none()Nobody. A notification can exist without a recipient while a form is being built.
get_kind()Which of the three this is.
is_addresses()Whether this is a fixed list of addresses.
is_field()Whether the address comes from a field.
is_routing()Whether the address is chosen by rule.
get_addresses()The addresses; empty unless this is an address list.
get_field_id()The field holding the address; zero unless this is a field reference.
get_rules()The routing rules; empty unless this is routed.
is_empty()Whether there is anybody to send to.

Method Reference

to_array()

public function to_array(): array

The recipient as plain data.

Only the case's own value is written. A field id carried alongside an address list would reappear the next time the recipient is switched back to a field.

Returns

  • array

Since: %ver%

Source: src/Schema/Recipient.php:55

from_array()

public static function from_array( $recipient ): self

Reads a recipient back.

An unreadable recipient becomes nobody rather than a guess: rebuilt as the wrong case it sends the form's mail to the wrong people.

Parameters

NameTypeDefaultDescription
$recipientmixedCandidate recipient.

Returns

  • self

Since: %ver%

Source: src/Schema/Recipient.php:79

addresses()

public static function addresses( string $addresses ): self

A fixed list of addresses.

Parameters

NameTypeDefaultDescription
$addressesstringOne address, or several separated by commas.

Returns

  • self

Since: %ver%

Source: src/Schema/Recipient.php:159

field()

public static function field( $field_id ): self

Whatever address the submitter entered in a field.

Parameters

NameTypeDefaultDescription
$field_idint | stringThe field holding the address.

Returns

  • self

Since: %ver%

Source: src/Schema/Recipient.php:175

routing()

public static function routing( array $rules ): self

An address chosen by rule.

Parameters

NameTypeDefaultDescription
$rulesarrayThe routing rules.

Returns

  • self

Since: %ver%

Source: src/Schema/Recipient.php:191

none()

public static function none(): self

Nobody. A notification can exist without a recipient while a form is being built.

Returns

  • self

Since: %ver%

Source: src/Schema/Recipient.php:205

get_kind()

public function get_kind(): string

Which of the three this is.

Returns

  • string

Since: %ver%

Source: src/Schema/Recipient.php:216

is_addresses()

public function is_addresses(): bool

Whether this is a fixed list of addresses.

Returns

  • bool

Since: %ver%

Source: src/Schema/Recipient.php:227

is_field()

public function is_field(): bool

Whether the address comes from a field.

Returns

  • bool

Since: %ver%

Source: src/Schema/Recipient.php:238

is_routing()

public function is_routing(): bool

Whether the address is chosen by rule.

Returns

  • bool

Since: %ver%

Source: src/Schema/Recipient.php:249

get_addresses()

public function get_addresses(): string

The addresses; empty unless this is an address list.

Returns

  • string

Since: %ver%

Source: src/Schema/Recipient.php:260

get_field_id()

public function get_field_id()

The field holding the address; zero unless this is a field reference.

Returns

  • int | string

Since: %ver%

Source: src/Schema/Recipient.php:271

get_rules()

public function get_rules(): array

The routing rules; empty unless this is routed.

Returns

  • array

Since: %ver%

Source: src/Schema/Recipient.php:282

is_empty()

public function is_empty(): bool

Whether there is anybody to send to.

Returns

  • bool

Since: %ver%

Source: src/Schema/Recipient.php:293