|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Canvas\Api\Controllers; |
|
6
|
|
|
|
|
7
|
|
|
use Canvas\Models\Apps; |
|
8
|
|
|
use Phalcon\Http\Response; |
|
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class LanguagesController. |
|
12
|
|
|
* |
|
13
|
|
|
* @package Canvas\Api\Controllers |
|
14
|
|
|
* |
|
15
|
|
|
*/ |
|
16
|
|
|
class AppsController extends BaseController |
|
17
|
|
|
{ |
|
18
|
|
|
/* |
|
19
|
|
|
* fields we accept to create |
|
20
|
|
|
* |
|
21
|
|
|
* @var array |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $createFields = []; |
|
24
|
|
|
|
|
25
|
|
|
/* |
|
26
|
|
|
* fields we accept to create |
|
27
|
|
|
* |
|
28
|
|
|
* @var array |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $updateFields = []; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* set objects. |
|
34
|
|
|
* |
|
35
|
|
|
* @return void |
|
36
|
|
|
*/ |
|
37
|
|
|
public function onConstruct() |
|
38
|
|
|
{ |
|
39
|
|
|
$this->model = new Apps(); |
|
|
|
|
|
|
40
|
|
|
$this->additionalSearchFields = [ |
|
|
|
|
|
|
41
|
|
|
['is_deleted', ':', '0'], |
|
42
|
|
|
['id', ':', implode('|', $this->userData->getAssociatedApps())], |
|
43
|
|
|
]; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* get item. |
|
48
|
|
|
* |
|
49
|
|
|
* @param mixed $id |
|
50
|
|
|
* |
|
51
|
|
|
* @method GET |
|
52
|
|
|
* @url /v1/data/{id} |
|
53
|
|
|
* |
|
54
|
|
|
* @return \Phalcon\Http\Response |
|
55
|
|
|
*/ |
|
56
|
|
|
public function getById($id = null): Response |
|
57
|
|
|
{ |
|
58
|
|
|
//find the info |
|
59
|
|
|
$record = $this->model->findFirstOrFail([ |
|
60
|
|
|
'id = ?0 AND is_deleted = 0 AND id in (' . implode(',', $this->userData->getAssociatedApps()) . ')', |
|
61
|
|
|
'bind' => [$id], |
|
62
|
|
|
]); |
|
63
|
|
|
|
|
64
|
|
|
//get the results and append its relationships |
|
65
|
|
|
$result = $this->appendRelationshipsToResult($this->request, $record); |
|
66
|
|
|
|
|
67
|
|
|
return $this->response($this->processOutput($result)); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Delete a Record. |
|
72
|
|
|
* |
|
73
|
|
|
* @throws Exception |
|
74
|
|
|
* @return Response |
|
75
|
|
|
*/ |
|
76
|
|
|
public function delete($id): Response |
|
77
|
|
|
{ |
|
78
|
|
|
return $this->response('Cant delete app at the moment'); |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths