Commit a2321aea11803d925a6463c40b0501889439c123
1 parent
1e53f412
test
Showing
2 changed files
with
20 additions
and
4 deletions
Show diff stats
app/library/App/Controllers/ProjectController.php
@@ -23,4 +23,21 @@ class ProjectController extends CrudResourceController { | @@ -23,4 +23,21 @@ class ProjectController extends CrudResourceController { | ||
23 | 23 | ||
24 | } | 24 | } |
25 | 25 | ||
26 | + public function find($id) | ||
27 | + { | ||
28 | + $item = $this->getFindData($id); | ||
29 | + | ||
30 | + if (!$item) { | ||
31 | + return $this->onItemNotFound($id); | ||
32 | + } | ||
33 | + | ||
34 | + if (!$this->findAllowed($id, $item)) { | ||
35 | + return $this->onNotAllowed(); | ||
36 | + } | ||
37 | + | ||
38 | + $response = $this->getFindResponse($item); | ||
39 | + | ||
40 | + return '123'; | ||
41 | + } | ||
42 | + | ||
26 | } | 43 | } |
27 | \ No newline at end of file | 44 | \ No newline at end of file |
app/library/App/Resources/ProjectResource.php
@@ -30,14 +30,13 @@ class ProjectResource extends ApiResource { | @@ -30,14 +30,13 @@ class ProjectResource extends ApiResource { | ||
30 | ->collectionKey('projects') | 30 | ->collectionKey('projects') |
31 | ; | 31 | ; |
32 | 32 | ||
33 | - /** transformers **/ | 33 | + /** transformer **/ |
34 | $this | 34 | $this |
35 | ->transformer(ProjectTransformer::class); | 35 | ->transformer(ProjectTransformer::class); |
36 | 36 | ||
37 | - /** handlers **/ | 37 | + /** handler **/ |
38 | $this | 38 | $this |
39 | ->handler(ProjectController::class); | 39 | ->handler(ProjectController::class); |
40 | - //->handler(CrudResourceController::class); | ||
41 | 40 | ||
42 | /** general roles **/ | 41 | /** general roles **/ |
43 | $this | 42 | $this |
@@ -46,7 +45,7 @@ class ProjectResource extends ApiResource { | @@ -46,7 +45,7 @@ class ProjectResource extends ApiResource { | ||
46 | /** endpoints **/ | 45 | /** endpoints **/ |
47 | $this | 46 | $this |
48 | ->endpoint(ApiEndpoint::post('/test', 'test') | 47 | ->endpoint(ApiEndpoint::post('/test', 'test') |
49 | - ->description('Returns the currently logged in user') | 48 | + ->description('Just for test') |
50 | ) | 49 | ) |
51 | ->endpoint(ApiEndpoint::all()) | 50 | ->endpoint(ApiEndpoint::all()) |
52 | ->endpoint(ApiEndpoint::create()) | 51 | ->endpoint(ApiEndpoint::create()) |