-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathkyTicketCustomFieldGroup.php
62 lines (57 loc) · 1.44 KB
/
kyTicketCustomFieldGroup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* Kayako TicketCustomField object.
*
* @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
*/
class kyTicketCustomFieldGroup extends kyCustomFieldGroupBase
{
protected static $controller = '/Tickets/TicketCustomField';
/**
* Ticket identifier.
* @var int
*/
protected $ticket_id;
/**
* Constructor.
*
* @param int $ticket_id Ticket identifier.
* @param array|null $data Object data from XML response converted into array.
*/
public function __construct($ticket_id, $data = null)
{
parent::__construct($data);
$this->type = kyCustomFieldGroupBase::TYPE_TICKET;
$this->ticket_id = $ticket_id;
}
/**
* Fetches ticket custom fields groups from server.
*
* @param int $ticket_id Ticket identifier.
* @return kyResultSet
*/
public static function getAll()
{
list($ticket_id) = func_get_args();
$result = self::getRESTClient()->get(static::$controller, array($ticket_id));
$objects = array();
if (array_key_exists(static::$object_xml_name, $result)) {
foreach ($result[static::$object_xml_name] as $object_data) {
$objects[] = new static($ticket_id, $object_data);
}
}
return new kyResultSet($objects);
}
/**
* Returns identifier of the ticket that this group is associated with.
*
* @return int
*/
public function getTicketId()
{
return $this->ticket_id;
}
}