'error', 'key' => 'page', 'method' => 'saveProductToPage', 'data' => '', ]; $token = $request->headers->get('x-auth-token'); $security->isGranted('MAESTRO_PROJECT_PROJECTS_UPDATE', $token); if ($request->getContent()) { $params = json_decode($request->getContent(), true); $list = $page->saveProductToPage($id, $params['products']); if ($list) { $body['type'] = 'success'; $body['data'] = $list; $respond->statusOK(); //DELETE THE CACHE IF WE HAVE, BECAUSE THE VALUE WAS CHANGED if ($id > 0) { $cache = new FilesystemAdapter(); $cache->clear(); } //END DELETING CACHE } else { $respond->statusUnauthorized(); } } else { $body['key'] = 'request'; $body['method'] = 'getContent'; $body['data'] = 'Please provide products !'; $respond->statusUnprocessableEntity(); } return $respond->createBody($body)->respond(); } }