1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Helix\Asana\Project; |
4
|
|
|
|
5
|
|
|
use Helix\Asana\Base\AbstractEntity; |
6
|
|
|
use Helix\Asana\Base\AbstractEntity\CreateTrait; |
7
|
|
|
use Helix\Asana\Base\AbstractEntity\DeleteTrait; |
8
|
|
|
use Helix\Asana\Project; |
9
|
|
|
use Helix\Asana\User; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* A project status. |
13
|
|
|
* |
14
|
|
|
* @see https://developers.asana.com/docs/asana-project-statuses |
15
|
|
|
* @see https://developers.asana.com/docs/project-status |
16
|
|
|
* |
17
|
|
|
* @immutable Statuses may only be deleted after creation. |
18
|
|
|
* |
19
|
|
|
* @method string getColor () |
20
|
|
|
* @method $this setColor (string $color) @depends create-only |
21
|
|
|
* @method string getCreatedAt () |
22
|
|
|
* @method User getCreatedBy () |
23
|
|
|
* @method string getHtmlText () |
24
|
|
|
* @method $this setHtmlText (string $text) @depends create-only |
25
|
|
|
* @method string getText () |
26
|
|
|
* @method $this setText (string $text) @depends create-only |
27
|
|
|
* @method string getTitle () |
28
|
|
|
*/ |
29
|
|
|
class Status extends AbstractEntity { |
30
|
|
|
|
31
|
|
|
use CreateTrait; |
32
|
|
|
use DeleteTrait; |
33
|
|
|
|
34
|
|
|
const TYPE = 'project_status'; |
35
|
|
|
|
36
|
|
|
const COLOR_GREEN = 'green'; |
37
|
|
|
const COLOR_RED = 'red'; |
38
|
|
|
const COLOR_YELLOW = 'yellow'; |
39
|
|
|
|
40
|
|
|
protected static $map = [ |
41
|
|
|
'created_by' => User::class |
42
|
|
|
]; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var Project |
46
|
|
|
*/ |
47
|
|
|
protected $project; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Remote doesn't have a `project` property, so it's required here. |
51
|
|
|
* |
52
|
|
|
* @param Project $project |
53
|
|
|
* @param array $data |
54
|
|
|
*/ |
55
|
|
|
public function __construct (Project $project, array $data = []) { |
56
|
|
|
parent::__construct($project, $data); |
57
|
|
|
$this->project = $project; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
final public function __toString (): string { |
61
|
|
|
return "project_statuses/{$this->getGid()}"; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
final protected function _getDir (): string { |
65
|
|
|
return "{$this->project}/project_statuses"; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return Project |
70
|
|
|
*/ |
71
|
|
|
public function getProject () { |
72
|
|
|
return $this->project; |
73
|
|
|
} |
74
|
|
|
} |