headers->get('x-auth-token'); $security->isGranted('MAESTRO_PROJECT_TEMPLATE_UPDATE', $token); $userId = $security->getUser()->getId(); $data = json_decode($request->getContent(), true); $templateId = $data['templateId']; $existingTwig = $twigReadQuery->isNameAlreadyExist($data['twigName'], $id); if (!$existingTwig) { $twigContent = isset($data['twigContent']) ? $data['twigContent'] : null; if (true === strpos($twigContent, '= strpos($twigContent, '') || 0 === strpos($twigContent, '{')) { $twigView = new TwigView( $id, isset($data['twigName']) ? $data['twigName'] : null, isset($data['exportType']) ? (int) $data['exportType'] : null, $twigContent, [$templateId] ); $updated = $twigUpdateQuery->update($twigView); $body = new CommonResponseView($updated, "update", "twig", "success"); //DELETE THE CACHE IF WE HAVE, BECAUSE THE VALUE WAS CHANGED $cache = new FilesystemAdapter(); $cache->deleteItem('template_'.$templateId.'_'.$userId); //END DELETING CACHE return $respond->statusOK()->createBodyObject($body)->respond(); } else { throw new UnprocessableEntityMaestroException("Twig's content.", "twig", "strpos"); } } else { throw new InternalServerErrorMaestroException("Twig's name.", "twig", "isNameAlreadyExist"); } } }