Exemple #1
0
 /**
  * Register a new client.
  * 
  * @param \Symfony\Component\HttpFoundation\Request $resquest
  */
 public function getCreateClientDataAction(Request $request)
 {
     $clientName = $request->get('cname');
     $client = new Client();
     $userService = $this->get('UserService');
     $em = $this->getDoctrine()->getManager();
     $client_entity = $em->getRepository('VlreleasesUserBundle:Client')->findOneBy(array("clientName" => $clientName));
     if (empty($client_entity)) {
         $client->setClientName($clientName);
         $client->setStatus('1');
         $result = $userService->save($client);
         if (!empty($result)) {
             $err = 0;
         } else {
             $err = 1;
         }
     } else {
         $err = 1;
     }
     echo $err;
     exit;
 }
 /**
  * {@inheritDoc}
  */
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) parent::getId();
     }
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());
     return parent::getId();
 }