'__MyTemplates__', 'cache' => '/tmp/cache/mustache', 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'), 'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views/partials'), 'escape' => function ($value) { return htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); }, 'charset' => 'ISO-8859-1', )); return $mustache; } function return_error($e, array $extra = null) { header('Content-Type: application/json'); $data =[ 'return_code'=>'-1', 'exception_code'=>$e->getCode(), 'exception_message'=>$e->getMessage(), 'exception_trace'=>$e->getTrace() ]; if ($extra) { $data['extra'] = $extra; } echo json_encode($data); exit(200); } function return_generic_error($data) { header('Content-Type: application/json'); echo json_encode([ 'return_code'=>'-2', 'error'=>$data ]); exit(200); } function return_ok($data) { header('Content-Type: application/json'); $data = [ 'return_code'=>'1', 'data'=>$data ]; echo json_encode($data); exit(200); } $db_conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams); $schema = new PersoSchema([], $db_conn);