Commit 89b5dccb28298c6b23b0bacc0c3f7efa44bc8ef5
1 parent
9b9bc6cb
test
Showing
1 changed file
with
19 additions
and
0 deletions
Show diff stats
app/library/App/Controllers/ProjectController.php
@@ -25,6 +25,9 @@ class ProjectController extends CrudResourceController { | @@ -25,6 +25,9 @@ class ProjectController extends CrudResourceController { | ||
25 | 25 | ||
26 | public function test_get($id) | 26 | public function test_get($id) |
27 | { | 27 | { |
28 | + | ||
29 | + | ||
30 | + | ||
28 | $item = $this->getFindData($id); | 31 | $item = $this->getFindData($id); |
29 | return 'breakpoint'; | 32 | return 'breakpoint'; |
30 | if (!$item) { | 33 | if (!$item) { |
@@ -40,4 +43,20 @@ class ProjectController extends CrudResourceController { | @@ -40,4 +43,20 @@ class ProjectController extends CrudResourceController { | ||
40 | return '123'; | 43 | return '123'; |
41 | } | 44 | } |
42 | 45 | ||
46 | + protected function getFindData($id) | ||
47 | + { | ||
48 | + $phqlBuilder = $this->phqlQueryParser->fromQuery($this->query, $this->getResource()); | ||
49 | + | ||
50 | + $phqlBuilder | ||
51 | + ->andWhere('[' . $this->getResource()->getModel() . '].' . $this->getModelPrimaryKey() . ' = '.$id) | ||
52 | + ->limit(1); | ||
53 | + | ||
54 | + $this->modifyReadQuery($phqlBuilder); | ||
55 | + $this->modifyFindQuery($phqlBuilder, $id); | ||
56 | + | ||
57 | + $results = $phqlBuilder->getQuery()->execute(); | ||
58 | + | ||
59 | + return count($results) >= 1 ? $results->getFirst() : null; | ||
60 | + } | ||
61 | + | ||
43 | } | 62 | } |
44 | \ No newline at end of file | 63 | \ No newline at end of file |