public function execute($request)
 {
     $this->setLayout(false);
     sfConfig::set('sf_web_debug', false);
     sfConfig::set('sf_debug', false);
     if ($this->getRequest()->isXmlHttpRequest()) {
         $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8');
     }
     $nationalityId = $request->getParameter('id');
     $service = new NationalityService();
     $nationality = $service->getNationalityById($nationalityId);
     return $this->renderText(json_encode($nationality->toArray()));
 }
Пример #2
0
 /**
  * Delete Delete EthnicRace
  * @param sfWebRequest $request
  * @return unknown_type
  */
 public function executeDeleteEthnicRace(sfWebRequest $request)
 {
     if (count($request->getParameter('chkLocID')) > 0) {
         $nationalityService = new NationalityService();
         $nationalityService->deleteEthnicRace($request->getParameter('chkLocID'));
         $this->setMessage('SUCCESS', array(TopLevelMessages::DELETE_SUCCESS));
     } else {
         $this->setMessage('NOTICE', array(TopLevelMessages::SELECT_RECORDS));
     }
     $this->redirect('admin/listEthnicRace');
 }