Kayako UserOrganization object.

All objects interacting with Kayako REST API should extend this class and define: * Kayako controller * XML element name holding object's data in REST response

author Tomasz Sawicki (https://github.com/Furgas)
link http://wiki.kayako.com/display/DEV/REST+-+UserOrganization
since Kayako version 4.01.204
package Object\User

 Methods

Default constructor.

__construct(array $data) 
Inherited

inherited_from \kyObjectBase::__construct()

Parameters

$data

array

Object data from XML response converted into array.

Returns API field value.

__get(string $api_field_name) : mixed
Inherited

Returns API field value based on API field name used by Kayako.

link http://wiki.kayako.com/display/DEV/REST+API+Reference
inherited_from \kyObjectBase::__get()

Parameters

$api_field_name

string

API field name.

Returns

mixed

Sets API field value.

__set(string $api_field_name, mixed $value) : mixed
Inherited

Sets API field value based on API field name used by Kayako.

link http://wiki.kayako.com/display/DEV/REST+API+Reference
inherited_from \kyObjectBase::__set()

Parameters

$api_field_name

string

API field name.

$value

mixed

API field value.

Returns

mixed

Returns object description with it's type and identifier.

__toString() : string
Inherited

Calls toString() method to get the object description.

inherited_from \kyObjectBase::__toString()

Returns

string

Should build the array of object data for creating or updating the object.

buildData(bool $create) : array

Values must be set in format accepted by REST API.

Parameters

$create

bool

Indicates if the result will be used to create (true) or update (false) an object.

Returns

array

Checks wheter this object has all required fields set.

checkRequiredAPIFields(bool $create, bool $throw_exception) : string[] | bool
Inherited

inherited_from \kyObjectBase::checkRequiredAPIFields()

Parameters

$create

bool

True when object will be created. False when object will be updated.

$throw_exception

bool

True to throw an exception on missing fields. False to return list of missing fields or true when there are none.

Exceptions

\kyException When there are missing field values and $throw_exception is true.

Returns

string[]boolList of missing API fields or true when there are none.

Creates an object on the server and refreshes its local data.

create() : \kyObjectBase
Inherited

inherited_from \kyObjectBase::create()

Exceptions

\BadMethodCallException
\kyException

Returns

Creates new object.

createNew() 
Inherited

Compatible with method chaining.

inherited_from \kyObjectBase::createNew()

Deletes the object on the server.

delete() 
Inherited

inherited_from \kyObjectBase::delete()

Fetches the object from server.

get(int | array $id) : \kyObjectBase
Inherited

inherited_from \kyObjectBase::get()

Parameters

$id

intarray

Object identifier or list of identifiers (ex. ticket identifier and ticket post identifier when fetching TicketPost).

Returns

Returns array of API fields.

getAPIFields() : string[]
Inherited

Format of returned array:

array(
    '' => Field description. (getter: , setter: ),
    ...repeat...
)

inherited_from \kyObjectBase::getAPIFields()

Returns

string[]

Returns user organization address.

getAddress() 

returns string
filterBy
orderBy

Fetches objects from server.

getAll(array $search_parameters) : \kyResultSet
Inherited

inherited_from \kyObjectBase::getAll()

Parameters

$search_parameters

array

Optional. Additional search parameters.

Returns

Returns list of available filter methods for use in result sets with objects of this type.

getAvailableFilterMethods(bool $filter_names_only) : array
Inherited

Optionaly you can return get method names used to filter objects.

inherited_from \kyObjectBase::getAvailableFilterMethods()

Parameters

$filter_names_only

bool

True (default) to return array('filterByXXX', 'filterByYYY', ...). False to return array('filterByXXX' => 'getXXX', 'filterByYYY' => 'YYY', ...).

Returns

array

Returns list of available order methods for use in result sets with objects of this type.

getAvailableOrderMethods(bool $order_names_only) : array
Inherited

Optionaly you can return get method names used to order objects.

inherited_from \kyObjectBase::getAvailableOrderMethods()

Parameters

$order_names_only

bool

True (default) to return array('orderByXXX', 'orderByYYY', ...). False to return array('orderByXXX' => 'getXXX', 'orderByYYY' => 'YYY', ...).

Returns

array

Returns user organization city.

getCity() 

returns string
filterBy
orderBy

Returns object controller.

getController() : string
Inherited

inherited_from \kyObjectBase::getController()

Returns

string

Returns user organization country.

getCountry() 

returns string
filterBy
orderBy

Returns date and time when the user organization was created.

getDateline(string $format) : string

see \global\http://www.php.net/manual/en/function.date.php
filterBy
orderBy

Parameters

$format

string

Output format of the date. If null the format set in client configuration is used.

Returns

string

Returns user organization FAX number.

getFAX() 

returns string
filterBy

Should return object identifier or complete list of identifiers as needed by API to identify the object (ex.

getId(bool $complete) : int | array

ticket identifier and ticket post identifier in case of TicketPost).

Parameters

$complete

bool

True to return complete list of identifiers as needed by API to identify the object.

Returns

intarray

Returns date and time when the user organization was last updated.

getLastUpdate(string $format) : string

see \global\http://www.php.net/manual/en/function.date.php
filterBy
orderBy

Parameters

$format

string

Output format of the date. If null the format set in client configuration is used.

Returns

string

Returns user organization name.

getName() 

returns string
filterBy
orderBy

Returns user organization phone number.

getPhone() 

returns string
filterBy

Returns user organization postal code.

getPostalCode() 

returns string
filterBy
orderBy

Returns list of required API fields for objects of this class.

getRequiredAPIFields(bool $create) : string[]
Inherited

inherited_from \kyObjectBase::getRequiredAPIFields()

Parameters

$create

bool

True when object will be created. False when object will be updated.

Returns

string[]

Returns expiration date of Service Level Agreement plan assignment or null when expiration is disabled.

getSLAPlanExpiry(string $format) : string

see \global\http://www.php.net/manual/en/function.date.php
filterBy
orderBy

Parameters

$format

string

Output format of the date. If null the format set in client configuration is used.

Returns

string

Return Service Level Agreement plan assigned to the user organization.

getSLAPlanId() : int

filterBy

Returns

int

Returns user organization state.

getState() 

returns string
filterBy
orderBy

Returns user organization type.

getType() 

see \global\kyUserOrganization::TYPE
returns string
filterBy
orderBy

Returns user organization website URL.

getWebsite() 

returns string
filterBy

Returns whether the object is new and not yet saved on the server.

isNew() : bool
Inherited

inherited_from \kyObjectBase::isNew()

Returns

bool

Returns whether this object is read only.

isReadOnly() : bool
Inherited

inherited_from \kyObjectBase::isReadOnly()

Returns

bool

Refreshes the object data from server.

refresh() : \kyObjectBase
Inherited

inherited_from \kyObjectBase::refresh()

Exceptions

\BadMethodCallException

Returns

Saves (creates or updates) the object to the server.

save() : \kyObjectBase
Inherited

inherited_from \kyObjectBase::save()

Returns

Sets user organization address.

setAddress(string $address) : \kyUserOrganization

Parameters

$address

string

User organization address.

Returns

Sets user organization city.

setCity(string $city) : \kyUserOrganization

Parameters

$city

string

User organization city.

Returns

Sets user organization country.

setCountry(string $country) : \kyUserOrganization

Parameters

$country

string

User organization country.

Returns

Sets user organization FAX number.

setFAX(string $fax) : \kyUserOrganization

Parameters

$fax

string

User organization FAX number.

Returns

Sets user organization name.

setName(string $name) : \kyUserOrganization

Parameters

$name

string

User organization name.

Returns

Sets user organization phone number.

setPhone(string $phone) : \kyUserOrganization

Parameters

$phone

string

User organization phone number.

Returns

Sets user organization postal code.

setPostalCode(string $postal_code) : \kyUserOrganization

Parameters

$postal_code

string

User organization postal code.

Returns

Sets whether this object is read only.

setReadOnly(bool $read_only) : bool
Inherited

inherited_from \kyObjectBase::setReadOnly()

Parameters

$read_only

bool

Read only flag.

Returns

bool

Sets expiration date of Service Level Agreement plan assignment.

setSLAPlanExpiry(string | int | null $sla_plan_expiry) : \kyUserOrganization

see \global\http://www.php.net/manual/en/function.strtotime.php

Parameters

$sla_plan_expiry

stringintnull

Date and time when Service Level Agreement plan for this user organization will expire (timestamp or string format understood by PHP strtotime). Null to disable expiration.

Returns

Sets identifier of the Service Level Agreement plan assigned to the user organization.

setSLAPlanId(int $sla_plan_id) : \kyUserOrganization

Parameters

$sla_plan_id

int

Service Level Agreement plan identifier.

Returns

Sets user organization state.

setState(string $state) : \kyUserOrganization

Parameters

$state

string

User organization state.

Returns

Sets user organization type.

setType(string $type) : \kyUserOrganization

see \global\kyUserOrganization::TYPE

Parameters

$type

string

User organization type

Returns

Sets user organization website URL.

setWebsite(string $website) : \kyUserOrganization

Parameters

$website

string

User organization website URL.

Returns

Should return short (one line) description of the object (it's title, name, etc.).

toString() : string

Returns

string

Updates the object on the server and refreshes its local data.

update() : \kyObjectBase
Inherited

inherited_from \kyObjectBase::update()

Exceptions

\BadMethodCallException
\kyException

Returns

Returns REST client.

getRESTClient() : \kyRESTClientInterface
Inherited

inherited_from \kyObjectBase::getRESTClient()

Returns

Should use passed data to fill object properties.

parseData(array $data) 

Parameters

$data

array

Object data from XML response.

Builds API fields list.

initAPIFieldsAccessors() 
Inherited

Scans protected and private properties of called class, searches for

apiField [name=field name] [accessor=setter/getter name] [getter=getter name] [setter=setter name] [required_create=true if field if required when creating object] [required_update=true if field if required when udpating object] [required=true if field if required when creating or updating object] and builds API field list with property name, description, setter and getter method names, and required flags.
see \global\kyObjectBase::$_api_fields
inherited_from \kyObjectBase::initAPIFieldsAccessors()

 Properties

 

Cache for available filter methods.

$_filter_methods : string[]
Inherited

Format: array( '' => array( '' => '', ...repeat for every filtering enabled method... ), ...repeat for every object class... )

inherited_from \kyObjectBase::$$_filter_methods
 

Cache for available order methods.

$_order_methods : string[]
Inherited

Format: array( '' => array( '' => '', ...repeat for every ordering enabled method... ), ...repeat for every object class... )

inherited_from \kyObjectBase::$$_order_methods
 

User organization address.

$address : string

apiField
 

User organization city.

$city : string

apiField
 

Default Kayako controller used to operate on this objects.

$controller : string

Override in descending classes.

 

User organization country.

$country : string

apiField
 

Timestamp of when the user organization was created.

$dateline : int

apiField
 

User organization FAX number.

$fax : string

apiField
 

User organization identifier.

$id : int

apiField
 

Timestamp of when the user organization was last updated.

$last_update : int

apiField
 

User organization name.

$name : string

apiField required=true
 

Indicates the name of object element in XML response.

$object_xml_name : string

Override in descending classes.

 

User organization phone number.

$phone : string

apiField
 

User organization postal code.

$postal_code : string

apiField
 

Controls if the object can be created/updated/deleted.

$read_only : bool
Inherited

Override in descending classes.

inherited_from \kyObjectBase::$$read_only
 

Timestamp of when the Service Level Agreement plan associated to this user organization will expire.

$sla_plan_expiry : int

apiField
 

Identifier of Service Level Agreement plan associated to this user organization.

$sla_plan_id : int

apiField
 

User organization state.

$state : string

apiField
 

User organization type.

$type : string

see \global\kyUserOrganization::TYPE
apiField name=organizationtype required_create=true
 

User organization website URL.

$website : string

apiField
 

Cache for API fields.

$_api_fields : array
Inherited

Format: array( '' => array( '' => array( 'property' => '', 'description' => '', 'getter' => '', 'setter' => '', 'required_create' => , 'required_update' => ), ...repeat for every class api field... ), ...repeat for every object class... )

inherited_from \kyObjectBase::$$_api_fields

 Constants

 

Data key for storing files to send as multipart/form-data.

FILES_DATA_NAME : string
Inherited

inherited_from \kyObjectBase::FILES_DATA_NAME
 

TYPE_RESTRICTED

TYPE_RESTRICTED 

 

TYPE_SHARED

TYPE_SHARED