/** * Delete employee dependents * * @param int $empNumber Employee number * * @return boolean true if successfully deleted, false otherwise */ public function execute($request) { $empNumber = $request->getParameter('empNumber', false); $this->form = new EmployeeDependentsDeleteForm(array(), array('empNumber' => $empNumber), true); $this->form->bind($request->getParameter($this->form->getName())); if (!$this->IsActionAccessible($empNumber)) { $this->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); } if ($this->form->isValid()) { if (!$empNumber) { throw new PIMServiceException("No Employee ID given"); } $dependentsToDelete = $request->getParameter('chkdependentdel', array()); if ($dependentsToDelete) { $service = new EmployeeService(); $count = $service->deleteDependents($empNumber, $dependentsToDelete); $this->getUser()->setFlash('templateMessage', array('success', __(TopLevelMessages::DELETE_SUCCESS))); } } $this->redirect('pim/viewDependents?empNumber=' . $empNumber); }