Kayako TicketCustomField 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+-+TicketCustomField
since Kayako version 4.01.220
package Object\Ticket

 Methods

Constructor.

__construct(int $ticket_id, array | null $data) 

Parameters

$ticket_id

int

Ticket identifier.

$data

arraynull

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()
inherited_from \kyCustomFieldGroupBase::__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()
inherited_from \kyCustomFieldGroupBase::__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()
inherited_from \kyCustomFieldGroupBase::__toString()

Returns

string

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

buildData(bool $create) : array
Inherited

Values must be set in format accepted by REST API.

inherited_from \kyCustomFieldGroupBase::buildData()

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()
inherited_from \kyCustomFieldGroupBase::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()
inherited_from \kyCustomFieldGroupBase::create()

Exceptions

\BadMethodCallException
\kyException

Returns

Creates new object.

createNew() 
Inherited

Compatible with method chaining.

inherited_from \kyObjectBase::createNew()
inherited_from \kyCustomFieldGroupBase::createNew()

Deletes the object on the server.

delete() 
Inherited

inherited_from \kyObjectBase::delete()
inherited_from \kyCustomFieldGroupBase::delete()

Fetches the object from server.

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

inherited_from \kyCustomFieldGroupBase::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()
inherited_from \kyCustomFieldGroupBase::getAPIFields()

Returns

string[]

Fetches ticket custom fields groups from server.

getAll(int $ticket_id) : \kyResultSet

Parameters

$ticket_id

int

Ticket identifier.

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()
inherited_from \kyCustomFieldGroupBase::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()
inherited_from \kyCustomFieldGroupBase::getAvailableOrderMethods()

Parameters

$order_names_only

bool

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

Returns

array

Returns object controller.

getController() : string
Inherited

inherited_from \kyObjectBase::getController()
inherited_from \kyCustomFieldGroupBase::getController()

Returns

string

Returns list of custom fields for this group.

getFields() : \kyResultSet
Inherited

inherited_from \kyCustomFieldGroupBase::getFields()

Returns

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

getId(bool $complete) : int | array
Inherited

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

inherited_from \kyCustomFieldGroupBase::getId()

Parameters

$complete

bool

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

Returns

intarray

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

getRequiredAPIFields(bool $create) : string[]
Inherited

inherited_from \kyObjectBase::getRequiredAPIFields()
inherited_from \kyCustomFieldGroupBase::getRequiredAPIFields()

Parameters

$create

bool

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

Returns

string[]

Returns identifier of the ticket that this group is associated with.

getTicketId() : int

Returns

int

Returns title of this custom fields group.

getTitle() : string
Inherited

filterBy
orderBy
inherited_from \kyCustomFieldGroupBase::getTitle()

Returns

string

Returns type of this custom fields group (one of kyCustomFieldGroupBase::TYPE_ constants).

getType() : int
Inherited

filterBy
orderBy
inherited_from \kyCustomFieldGroupBase::getType()

Returns

int

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

isNew() : bool
Inherited

inherited_from \kyObjectBase::isNew()
inherited_from \kyCustomFieldGroupBase::isNew()

Returns

bool

Returns whether this object is read only.

isReadOnly() : bool
Inherited

inherited_from \kyObjectBase::isReadOnly()
inherited_from \kyCustomFieldGroupBase::isReadOnly()

Returns

bool

Refreshes the object data from server.

refresh() : \kyObjectBase
Inherited

inherited_from \kyCustomFieldGroupBase::refresh()

Exceptions

\BadMethodCallException

Returns

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

save() : \kyObjectBase
Inherited

inherited_from \kyObjectBase::save()
inherited_from \kyCustomFieldGroupBase::save()

Returns

Sets whether this object is read only.

setReadOnly(bool $read_only) : bool
Inherited

inherited_from \kyObjectBase::setReadOnly()
inherited_from \kyCustomFieldGroupBase::setReadOnly()

Parameters

$read_only

bool

Read only flag.

Returns

bool

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

toString() : string
Inherited

inherited_from \kyCustomFieldGroupBase::toString()

Returns

string

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

update() : \kyObjectBase
Inherited

inherited_from \kyObjectBase::update()
inherited_from \kyCustomFieldGroupBase::update()

Exceptions

\BadMethodCallException
\kyException

Returns

Returns REST client.

getRESTClient() : \kyRESTClientInterface
Inherited

inherited_from \kyObjectBase::getRESTClient()
inherited_from \kyCustomFieldGroupBase::getRESTClient()

Returns

Should use passed data to fill object properties.

parseData(array $data) 
Inherited

inherited_from \kyCustomFieldGroupBase::parseData()

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()
inherited_from \kyCustomFieldGroupBase::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
inherited_from \kyCustomFieldGroupBase::$$_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
inherited_from \kyCustomFieldGroupBase::$$_order_methods
 

Default Kayako controller used to operate on this objects.

$controller : string

Override in descending classes.

 

List of custom fields in this group.

$fields : \kyCustomField[]
Inherited

inherited_from \kyCustomFieldGroupBase::$$fields
 

Custom field group identifier.

$id : int
Inherited

apiField
inherited_from \kyCustomFieldGroupBase::$$id
 

Indicates the name of object element in XML response.

$object_xml_name : string
Inherited

Override in descending classes.

inherited_from \kyCustomFieldGroupBase::$$object_xml_name
 

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

$read_only : bool
Inherited

Override in descending classes.

inherited_from \kyCustomFieldGroupBase::$$read_only
 

Ticket identifier.

$ticket_id : int

 

Custom field group title.

$title : string
Inherited

apiField
inherited_from \kyCustomFieldGroupBase::$$title
 

Type of custom field group.

$type : int
Inherited

see \global\kyCustomFieldGroupBase::TYPE
inherited_from \kyCustomFieldGroupBase::$$type
 

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
inherited_from \kyCustomFieldGroupBase::$$_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
inherited_from \kyCustomFieldGroupBase::FILES_DATA_NAME
 

TYPE_TICKET

TYPE_TICKET 
Inherited

inherited_from \kyCustomFieldGroupBase::TYPE_TICKET
 

TYPE_USER

TYPE_USER 
Inherited

inherited_from \kyCustomFieldGroupBase::TYPE_USER
 

TYPE_USER_LIVECHAT

TYPE_USER_LIVECHAT 
Inherited

inherited_from \kyCustomFieldGroupBase::TYPE_USER_LIVECHAT
 

TYPE_USER_ORGANIZATION

TYPE_USER_ORGANIZATION 
Inherited

inherited_from \kyCustomFieldGroupBase::TYPE_USER_ORGANIZATION
 

TYPE_USER_TIME_TRACK

TYPE_USER_TIME_TRACK 
Inherited

inherited_from \kyCustomFieldGroupBase::TYPE_USER_TIME_TRACK