\CGContactscontact_name

A class to represent a name.

A name consists of a prefix, a first, middle, and last part, and a suffix. Only one name object can be associated with a contact.

Summary

Methods
Properties
Constants
get_prefix()
set_prefix()
get_first()
set_first()
get_middle()
set_middle()
get_last()
set_last()
get_suffix()
set_suffix()
get_formatted()
to_data()
validate()
get_raw_value()
set_data()
__construct()
get_contact_id()
get_class()
get_label()
set_label()
is_preferred()
set_preferred()
allows_multiple()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

get_prefix()

get_prefix() : string

Get the prefix portion of the name.

Returns

string

set_prefix()

set_prefix(string $val)

Set the prefix portion of the name.

Parameters

string $val

get_first()

get_first() : string

Get the firstname portion of the name.

Returns

string

set_first()

set_first(string $val)

Set the firstname portion of the name.

Parameters

string $val

get_middle()

get_middle() : string

Get the middle portion of the name.

Returns

string

set_middle()

set_middle(string $val)

Set the middle portion of the name.

Parameters

string $val

get_last()

get_last() : string

Get the last portion of the name.

Returns

string

set_last()

set_last(string $val)

Set the last portion of the name.

Parameters

string $val

get_suffix()

get_suffix() : string

Get the name suffix.

Returns

string

set_suffix()

set_suffix(string $val)

Set the name suffix.

Parameters

string $val

get_formatted()

get_formatted() : string

Get the name formatted in a displayable format.

Returns

string

to_data()

to_data() : array

Convert this object to a data array.

Returns

array

validate()

validate()

Validate the contents of the object. Throw an exception if an error is encountered.

get_raw_value()

get_raw_value() : string

Get the raw value (for storing in the database) of this object.

Returns

string

set_data()

set_data(array $data)

Fill this object from a data array.

Parameters

array $data

__construct()

__construct(\CGContacts\contact $parent)

Constructor

Parameters

\CGContacts\contact $parent

A reference to the contact object that will own this object.

get_contact_id()

get_contact_id() : int

Return the id of the parent contact object.

If the contact object is new and has not been saved, it may not have an id.

Returns

int

get_class()

get_class() : string

Get the class (type) of this object.

Returns

string

get_label()

get_label() : string

Get the label, if any, associated with this object.

Returns

string

set_label()

set_label(string $label)

Set a label for this object.

Parameters

string $label

is_preferred()

is_preferred() : bool

Test if this object is a preferred object of its type for this contact.

Returns

bool

set_preferred()

set_preferred(mixed $flag)

Set the preferred flag for this object.

This method will attempt to interpret the passed value as a boolean in any way it can.

Parameters

mixed $flag

allows_multiple()

allows_multiple() : bool

Whether there can be multiple objects of this type associated with a contact.

Returns

bool