|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Blackmine\Repository\Projects; |
|
6
|
|
|
|
|
7
|
|
|
use Blackmine\Exception\MethodNotImplementedException; |
|
8
|
|
|
use Blackmine\Model\AbstractModel; |
|
9
|
|
|
use Blackmine\Model\Project\IssueCategory; |
|
10
|
|
|
use Blackmine\Repository\AbstractRepository; |
|
11
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
12
|
|
|
|
|
13
|
|
|
class IssueCategories extends AbstractRepository |
|
14
|
|
|
{ |
|
15
|
|
|
public const API_ROOT = "issue_categories"; |
|
16
|
|
|
|
|
17
|
|
|
public function getModelClass(): string |
|
18
|
|
|
{ |
|
19
|
|
|
return IssueCategory::class; |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @throws MethodNotImplementedException |
|
24
|
|
|
*/ |
|
25
|
|
|
public function all(?string $endpoint = null): ArrayCollection |
|
26
|
|
|
{ |
|
27
|
|
|
throw new MethodNotImplementedException( |
|
28
|
|
|
"Method " . __FUNCTION__ . " not implemented for apì: " . self::API_ROOT |
|
29
|
|
|
); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @throws MethodNotImplementedException |
|
34
|
|
|
*/ |
|
35
|
|
|
public function search(array $params = []): ArrayCollection |
|
36
|
|
|
{ |
|
37
|
|
|
throw new MethodNotImplementedException( |
|
38
|
|
|
"Method " . __FUNCTION__ . " not implemented for apì: " . self::API_ROOT |
|
39
|
|
|
); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @throws MethodNotImplementedException |
|
44
|
|
|
*/ |
|
45
|
|
|
public function create(AbstractModel $model): ?AbstractModel |
|
46
|
|
|
{ |
|
47
|
|
|
throw new MethodNotImplementedException( |
|
48
|
|
|
"Method " . __FUNCTION__ . " not implemented for apì: " . self::API_ROOT |
|
49
|
|
|
); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function delete(AbstractModel $model): void |
|
53
|
|
|
{ |
|
54
|
|
|
/** @var IssueCategory $model */ |
|
55
|
|
|
if ($model->getReassignTo() !== null) { |
|
56
|
|
|
$endpoint_url = $this->getEndpoint() . "/" . $model->getId() . "." . $this->client->getFormat() . "?reassign_to_id=" . $model->getReassignTo()->getId(); |
|
57
|
|
|
$this->client->delete($endpoint_url); |
|
58
|
|
|
} else { |
|
59
|
|
|
parent::delete($model); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|