예제 #1
0
 /**
  * @Route("/server/{platformid}/{serverid}/delete", name="_server_delete", requirements={
  *     "platformid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})",
  *     "serverid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})"
  * })
  */
 public function deleteAction(Request $request, $platformid, $serverid)
 {
     $platform_repository = (new PlatformPeer())->getLdapManager()->getRepository('platform');
     $platform = $platform_repository->getPlatformByUUID($platformid);
     try {
         $serverPeer = new ServerPeer($platform->getDn());
         $serverPeer->deleteServer($serverid);
     } catch (LdapConnectionException $e) {
         echo "Failed to delete server!" . PHP_EOL;
         echo $e->getMessage() . PHP_EOL;
     }
     return $this->redirectToRoute('_server', array('platformid' => $platform->getEntryUUID()));
 }