-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFieldValue.php
More file actions
66 lines (52 loc) · 1.41 KB
/
FieldValue.php
File metadata and controls
66 lines (52 loc) · 1.41 KB
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
63
64
65
66
<?php
/**
* Created by PhpStorm.
* User: ExE
* Date: 27.01.17
* Time: 12:03
*/
require_once "APIObject.php";
class FieldValue extends APIObject {
public $id;
public $field_id;
public $value;
public $display_value;
public $created_at;
public $updated_at;
public $card; // Card
/**
* @param null $data
*/
function __construct($data = null) {
if ($data != null) {
$this->assign_results($data);
}
}
/**
* @param null $field_id int
* @return $this
*/
public function fetch($field_value_id = null) {
if ($field_value_id == null)
$field_value_id = $this->id;
$resp = $this->send_get("https://app.pipefy.com/card_field_value/$field_value_id.json", null, null);
$this->assign_results($resp);
$this->parse_property("card", "Card");
return $this;
}
/**
* @param $value string
* @return $this
*/
public function set_value($value) {
if ($this->field_id == null || $this->card == null || $this->card->id == null)
$this->fetch();
$resp = $this->send_post("https://app.pipefy.com/card_field_value/{$this->id}.json", null, array(
"field_id" => $this->field_id,
"card_phase_detail_id" => $this->card->id,
"value" => $value
));
$this->assign_results($resp);
return $this;
}
}