|
@@ 86-94 (lines=9) @@
|
| 83 |
|
* @param string $operation |
| 84 |
|
* @return JSONResponse The added element |
| 85 |
|
*/ |
| 86 |
|
public function addOperation($class, $name, $checks, $operation) { |
| 87 |
|
try { |
| 88 |
|
$operation = $this->manager->addOperation($class, $name, $checks, $operation); |
| 89 |
|
$operation = $this->prepareOperation($operation); |
| 90 |
|
return new JSONResponse($operation); |
| 91 |
|
} catch (\UnexpectedValueException $e) { |
| 92 |
|
return new JSONResponse($e->getMessage(), Http::STATUS_BAD_REQUEST); |
| 93 |
|
} |
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
/** |
| 97 |
|
* @param int $id |
|
@@ 103-111 (lines=9) @@
|
| 100 |
|
* @param string $operation |
| 101 |
|
* @return JSONResponse The updated element |
| 102 |
|
*/ |
| 103 |
|
public function updateOperation($id, $name, $checks, $operation) { |
| 104 |
|
try { |
| 105 |
|
$operation = $this->manager->updateOperation($id, $name, $checks, $operation); |
| 106 |
|
$operation = $this->prepareOperation($operation); |
| 107 |
|
return new JSONResponse($operation); |
| 108 |
|
} catch (\UnexpectedValueException $e) { |
| 109 |
|
return new JSONResponse($e->getMessage(), Http::STATUS_BAD_REQUEST); |
| 110 |
|
} |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
/** |
| 114 |
|
* @param int $id |