@@ 119-129 (lines=11) @@ | ||
116 | * |
|
117 | * @return JsonResponse |
|
118 | */ |
|
119 | public function toggleAction(Request $request) |
|
120 | { |
|
121 | $name = $request->get('name'); |
|
122 | try { |
|
123 | $this->get('ongr_settings.settings_manager')->toggleExperiment($name); |
|
124 | } catch (\Exception $e) { |
|
125 | return new JsonResponse(['error' => true]); |
|
126 | } |
|
127 | ||
128 | return new JsonResponse(['error' => false]); |
|
129 | } |
|
130 | ||
131 | /** |
|
132 | * @param array $types |
@@ 83-98 (lines=16) @@ | ||
80 | * |
|
81 | * @return JsonResponse |
|
82 | */ |
|
83 | public function deleteAction(Request $request) |
|
84 | { |
|
85 | try { |
|
86 | $manager = $this->get('ongr_settings.settings_manager'); |
|
87 | $manager->delete($request->get('name')); |
|
88 | ||
89 | return new JsonResponse(['error' => false]); |
|
90 | } catch (\Exception $e) { |
|
91 | return new JsonResponse( |
|
92 | [ |
|
93 | 'error' => true, |
|
94 | 'message' => 'Error occurred please try to delete setting again.' |
|
95 | ] |
|
96 | ); |
|
97 | } |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * Submit action to create or edit setting if not exists. |