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

 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

Creates new ticket note.

createNew(\kyTicket $ticket, \kyStaff $creator, string $contents) : \kyTicketNote

WARNING: Data is not sent to Kayako unless you explicitly call create() on this method's result.

Parameters

$ticket

\kyTicket

Ticket in which to create the post.

$creator

\kyStaff

Creator (staff) of new note.

$contents

string

Contents of new note.

Returns

Deletes the object on the server.

delete() 

Returns ticket note.

get(int $ticket_id, int $id) : \kyTicketNote

Parameters

$ticket_id

int

Ticket identifier.

$id

int

Ticket note identifier.

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 all notes of the ticket.

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()

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 ticket note contents.

getContents() : string

filterBy

Returns

string

Returns object controller.

getController() : string
Inherited

inherited_from \kyObjectBase::getController()

Returns

string

Returns date and time this note was created.

getCreationDate(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 name of the creator of this ticket note.

getCreatorName() : string

filterBy
orderBy

Returns

string

Returns staff who created this note.

getCreatorStaff(bool $reload) : \kyStaff

Result is cached until the end of script.

Parameters

$reload

bool

True to reload data from server. False to use the cached value (if present).

Returns

Returns identifier of staff user who created this note.

getCreatorStaffId() : int

filterBy
orderBy

Returns

int

Returns the staff who this note is for.

getForStaff(bool $reload) : \kyStaff

Result is cached until the end of script.

Parameters

$reload

bool

True to reload data from server. False to use the cached value (if present).

Returns

Returns identifier of the staff who this note is for.

getForStaffId() : int

filterBy
orderBy

Returns

int

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 this ticket note color.

getNoteColor() : int

see \global\kyTicketNote::COLOR
filterBy

Returns

int

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 the ticket that this note is connected with.

getTicket(bool $reload) : \kyTicket

Applicable only for notes of type kyTicketNote::TYPE_TICKET. Result is cached until the end of script.

Parameters

$reload

bool

True to reload data from server. False to use the cached value (if present).

Returns

Returns identifier of ticket that this note is connected with.

getTicketId() : int

Applicable only for notes of type kyTicketNote::TYPE_TICKET.

Returns

int

Returns type of this ticket.

getType() : string

see \global\kyTicketNote::TYPE
filterBy
orderBy

Returns

string

Return the user that this note is connected to.

getUser(bool $reload) : \kyUser

Applicable only for notes of type kyTicketNote::TYPE_USER. Result is cached until the end of script.

Parameters

$reload

bool

True to reload data from server. False to use the cached value (if present).

Returns

Returns identifier of the user that this note is connected to.

getUserId() : int

Applicable only for notes of type kyTicketNote::TYPE_USER.

filterBy
orderBy

Returns

int

Returns the user organization that this note is connecte with.

getUserOrganization(bool $reload) : \kyUserOrganization

Applicable only for notes of type kyTicketNote::TYPE_USER_ORGANIZATION. Result is cached until the end of script.

Parameters

$reload

bool

True to reload data from server. False to use the cached value (if present).

Returns

Returns identifier of the user organization that this note is connecte with.

getUserOrganizationId() : int

Applicable only for notes of type kyTicketNote::TYPE_USER_ORGANIZATION.

filterBy
orderBy

Returns

int

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 the ticket note contents.

setContents(string $contents) : \kyTicketNote

Parameters

$contents

string

Returns

Sets creator of this note.

setCreator(\kyStaff | int | string $creator) : \kyTicketNote

Parameters

$creator

\kyStaffintstring

Staff OR Staff identifier OR creator name (if the ticket is to be created without providing a staff user, ex: System messages, Alerts etc.).

Returns

Sets the staff who this note is for.

setForStaff(\kyStaff $for_staff) : \kyTicketNote

Parameters

$for_staff

\kyStaff

Returns

Sets identifier of the staff who this note is for.

setForStaffId(int $for_staff_id) : \kyTicketNote

Parameters

$for_staff_id

int

Returns

Sets the color of this ticket note.

setNoteColor(int $note_color) : \kyTicketNote

see \global\kyTicketNote::COLOR

Parameters

$note_color

int

Note color.

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 the ticket that the note will be connected with.

setTicket(\kyTicket $ticket) : \kyTicketNote

Parameters

$ticket

\kyTicket

Returns

Sets identifier of the ticket that this note will be connected with.

setTicketId(int $ticket_id) : \kyTicketNote

Parameters

$ticket_id

int

Ticket identifier.

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

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
 

Ticket note contents.

$contents : string

apiField required_create=true
 

Default Kayako controller used to operate on this objects.

$controller : string

Override in descending classes.

 

Timestamp of when this ticket note was created.

$creation_date : int

apiField
 

Identifier of staff user who created this note.

$creator_staff_id : int

apiField alias=staffid
 

Full name of staff user who created this note.

$creator_staff_name : string

apiField getter=getCreatorName setter=setCreator alias=fullname
 

Identifier staff user that this note is intended for.

$for_staff_id : int

apiField
 

Ticket note identifier.

$id : int

apiField
 

Ticket note color.

$note_color : int

see \global\kyTicketNote::COLOR
apiField
 

Indicates the name of object element in XML response.

$object_xml_name : string

Override in descending classes.

 

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

$read_only : bool
Inherited

Override in descending classes.

inherited_from \kyObjectBase::$$read_only
 

Ticket identifier - if this note is associated with ticket.

$ticket_id : int

apiField required_create=true
 

Note type.

$type : string

see \global\kyTicketNote::TYPE
apiField
 

User identifier - if this note is associated with user who created the ticket.

$user_id : int

apiField
 

User organization identifier - if this note is associated with user organization of user who created the ticket.

$user_organization_id : int

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
 

Staff user who created this note.

$creator_staff : \kyStaff

 

Staff user that this note is intended for.

$for_staff : \kyStaff

 

Ticket - if this note is associated with ticket.

$ticket : \kyTicket

 

User - if this note is associated with user who created the ticket.

$user : \kyUser

 

User organization - if this note is associated with user organization of user who created the ticket.

$user_organization : \kyUserOrganization

 Constants

 

Color of note - blue.

COLOR_BLUE : int

 

Color of note - green.

COLOR_GREEN : int

 

Color of note - purple.

COLOR_PURPLE : int

 

Color of note - red.

COLOR_RED : int

 

Color of note - yellow.

COLOR_YELLOW : int

 

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

FILES_DATA_NAME : string
Inherited

inherited_from \kyObjectBase::FILES_DATA_NAME
 

Note type - connected to ticket.

TYPE_TICKET : string

 

Note type - connected to user.

TYPE_USER : string

 

Note type - connected to user organization.

TYPE_USER_ORGANIZATION : string