|
@@ 67-75 (lines=9) @@
|
| 64 |
|
* @param string $operation |
| 65 |
|
* @return JSONResponse The added element |
| 66 |
|
*/ |
| 67 |
|
public function addOperation($class, $name, $checks, $operation) { |
| 68 |
|
try { |
| 69 |
|
$operation = $this->manager->addOperation($class, $name, $checks, $operation); |
| 70 |
|
$operation = $this->prepareOperation($operation); |
| 71 |
|
return new JSONResponse($operation); |
| 72 |
|
} catch (\UnexpectedValueException $e) { |
| 73 |
|
return new JSONResponse($e->getMessage(), Http::STATUS_BAD_REQUEST); |
| 74 |
|
} |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
/** |
| 78 |
|
* @param int $id |
|
@@ 84-92 (lines=9) @@
|
| 81 |
|
* @param string $operation |
| 82 |
|
* @return JSONResponse The updated element |
| 83 |
|
*/ |
| 84 |
|
public function updateOperation($id, $name, $checks, $operation) { |
| 85 |
|
try { |
| 86 |
|
$operation = $this->manager->updateOperation($id, $name, $checks, $operation); |
| 87 |
|
$operation = $this->prepareOperation($operation); |
| 88 |
|
return new JSONResponse($operation); |
| 89 |
|
} catch (\UnexpectedValueException $e) { |
| 90 |
|
return new JSONResponse($e->getMessage(), Http::STATUS_BAD_REQUEST); |
| 91 |
|
} |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
/** |
| 95 |
|
* @param int $id |