Commit 93413f78c13f7fcaccfcee3557e6522329d8e5cd
1 parent
062f875d
registration
Showing
1 changed file
with
2 additions
and
23 deletions
Show diff stats
app/library/App/Controllers/UserController.php
| ... | ... | @@ -59,17 +59,13 @@ class UserController extends CrudResourceController |
| 59 | 59 | $item = $this->createModelInstance(); |
| 60 | 60 | |
| 61 | 61 | $newItem = $this->createItem($item, $data); |
| 62 | - $messages = $newItem->getMessages(); | |
| 63 | - | |
| 64 | - die(var_dump($messages)); | |
| 65 | 62 | |
| 66 | 63 | if (!$newItem) { |
| 67 | 64 | return $this->onCreateFailed($item, $data); |
| 68 | 65 | } |
| 69 | 66 | |
| 70 | - die(var_dump($newItem)); | |
| 71 | - $primaryKey = $this->getModelPrimaryKey(); | |
| 72 | - $responseData = $this->getFindData($newItem->$primaryKey); | |
| 67 | + $last_id = $newItem->getWriteConnection()->lastInsertId(); | |
| 68 | + $responseData = $this->getFindData($last_id); | |
| 73 | 69 | |
| 74 | 70 | $response = $this->getCreateResponse($responseData, $data); |
| 75 | 71 | |
| ... | ... | @@ -95,21 +91,4 @@ class UserController extends CrudResourceController |
| 95 | 91 | return 'id'; |
| 96 | 92 | } |
| 97 | 93 | |
| 98 | - protected function getFindData($id) | |
| 99 | - { | |
| 100 | - $phqlBuilder = $this->phqlQueryParser->fromQuery($this->query, $this->getResource()); | |
| 101 | - | |
| 102 | - $phqlBuilder | |
| 103 | - ->andWhere('[' . $this->getResource()->getModel() . '].' . $this->getModelPrimaryKey() . ' = :id:', | |
| 104 | - ['id' => $id]) | |
| 105 | - ->limit(1); | |
| 106 | - | |
| 107 | - $this->modifyReadQuery($phqlBuilder); | |
| 108 | - $this->modifyFindQuery($phqlBuilder, $id); | |
| 109 | - | |
| 110 | - $results = $phqlBuilder->getQuery()->execute(); | |
| 111 | - | |
| 112 | - return count($results) >= 1 ? $results->getFirst() : null; | |
| 113 | - } | |
| 114 | - | |
| 115 | 94 | } | ... | ... |