public function transPlatform($ldapObject) { $platform = new Platform(); $platform->setCn($ldapObject->getCn()); $platform->setZacaciastatus($ldapObject->getZacaciastatus()); return $platform; }
/** * @Route("/platform/new", name="_platform_new") */ public function newAction(Request $request) { $platform = new Platform(); $platform->setZacaciastatus("enable"); $form = $this->createForm(PlatformType::class, $platform); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { try { $platformPeer = new PlatformPeer(); $platformPeer->createPlatform($platform); return $this->redirectToRoute('_platform'); } catch (LdapConnectionException $e) { echo "Failed to add platform!" . PHP_EOL; echo $e->getMessage() . PHP_EOL; } } return $this->render('ZacaciaBundle:Platform:new.html.twig', array('form' => $form->createView())); }