headers->get('x-auth-token'); $security->isGranted('MAESTRO_PROJECT_PROJECTS_DELETE', $token); $document = $deleteQuery->removeMedia($id); if ($document) { $body = [ 'type' => 'success', 'key' => 'document', 'method' => 'delete', 'data' => $document, ]; $respond->statusOK(); //DELETE THE CACHE IF WE HAVE, BECAUSE THE VALUE WAS CHANGED if ($pageId > 0) { $cache = new FilesystemAdapter(); $cache->clear(); } //END DELETING CACHE } else { $body = [ 'type' => 'error', 'key' => 'document', 'method' => 'delete', 'data' => '', ]; $respond->statusNotFound(); } return $respond->createBody($body)->respond(); } }