'error', 'key' => 'flux', 'method' => 'create', 'data' => '' ]; $token = $request->headers->get('x-auth-token'); $security->isGranted('MAESTRO_PROJECT_PROJECTS_CREATE', $token); $userId = $profile->getUserIdFromToken($token); $validate = $this->validate($request, $respond); if (true === $validate) { $data = json_decode($request->getContent(), true); $project = $fluxQuery->save($id, $data['flux']); if ($project) { $body['type'] = 'success'; $body['data'] = $project; $respond->statusCreated(); //DELETE THE CACHE IF WE HAVE, BECAUSE THE VALUE WAS CHANGED $cache = new FilesystemAdapter(); $cache->clear(); //END DELETING CACHE } else { $respond->statusUnprocessableEntity(); } } else { $body['key'] = 'request'; $body['method'] = 'validate'; $respond->statusUnprocessableEntity(); } return $respond->createBody($body)->respond(); } }