if ($mastCoreService->synchronization()) { return $response->write(json_encode('Synchronized with success', true)); } else { return $response->write(json_encode('Synchronized with errors', true)); } } catch (Exception $e) { error_log($e->getMessage()); } return error($response, 'SYNCHRONISATION ERROR'); }); $app->get('/getAllTypes', function (\Slim\Http\Request $request, \Slim\Http\Response $response, $args) use($app) { try { if (!has_access($request)) { return access_denied($response); } $typeServices = new TypeService(); $types = $typeServices->getAllTypes(); if ($types != []) { return $response->write(json_encode($types, true)); } } catch (Exception $e) { error_log($e->getMessage()); } return error($response, 'GETALLTYPES ERROR'); }); $app->get('/getAllContacts', function (\Slim\Http\Request $request, \Slim\Http\Response $response, $args) use($app) { try { if (!has_access($request)) { return access_denied($response); } $contactService = new ContactService();
public function getTypeFromName($name) { $typeService = new TypeService(); $nameAndType = $this->splitn($name, '--', sizeof($name)); if ($nameAndType != false && sizeof($nameAndType) >= 2) { $typeId = $typeService->getTypeIdByLabel($nameAndType[1]); if ($typeId != -1) { return [$nameAndType[0], $typeId]; } } return []; }