@@ 55-69 (lines=15) @@ | ||
52 | * @param string $model_name |
|
53 | * @return WP_REST_Response|\WP_Error |
|
54 | */ |
|
55 | public static function handleRequestInsert(WP_REST_Request $request, $version, $model_name) |
|
56 | { |
|
57 | $controller = new Write(); |
|
58 | try { |
|
59 | $controller->setRequestedVersion($version); |
|
60 | return $controller->sendResponse( |
|
61 | $controller->insert( |
|
62 | $controller->getModelVersionInfo()->loadModel($model_name), |
|
63 | $request |
|
64 | ) |
|
65 | ); |
|
66 | } catch (\Exception $e) { |
|
67 | return $controller->sendResponse($e); |
|
68 | } |
|
69 | } |
|
70 | ||
71 | ||
72 | ||
@@ 81-95 (lines=15) @@ | ||
78 | * @param string $model_name |
|
79 | * @return WP_REST_Response|\WP_Error |
|
80 | */ |
|
81 | public static function handleRequestUpdate(WP_REST_Request $request, $version, $model_name) |
|
82 | { |
|
83 | $controller = new Write(); |
|
84 | try { |
|
85 | $controller->setRequestedVersion($version); |
|
86 | return $controller->sendResponse( |
|
87 | $controller->update( |
|
88 | $controller->getModelVersionInfo()->loadModel($model_name), |
|
89 | $request |
|
90 | ) |
|
91 | ); |
|
92 | } catch (\Exception $e) { |
|
93 | return $controller->sendResponse($e); |
|
94 | } |
|
95 | } |
|
96 | ||
97 | ||
98 | ||
@@ 107-121 (lines=15) @@ | ||
104 | * @param string $model_name |
|
105 | * @return WP_REST_Response|\WP_Error |
|
106 | */ |
|
107 | public static function handleRequestDelete(WP_REST_Request $request, $version, $model_name) |
|
108 | { |
|
109 | $controller = new Write(); |
|
110 | try { |
|
111 | $controller->setRequestedVersion($version); |
|
112 | return $controller->sendResponse( |
|
113 | $controller->delete( |
|
114 | $controller->getModelVersionInfo()->loadModel($model_name), |
|
115 | $request |
|
116 | ) |
|
117 | ); |
|
118 | } catch (\Exception $e) { |
|
119 | return $controller->sendResponse($e); |
|
120 | } |
|
121 | } |
|
122 | ||
123 | ||
124 |