public function executeDeleteChild() { $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('employee_id')); $this->forward404Unless($employee); $empl_child = EmployeeChildsPeer::retrieveByPK($this->getRequestParameter('id')); $this->forward404Unless($empl_child); $empl_child->delete(); return $this->redirect('employee/edit?id=' . $employee->getId()); }
</thead> <tbody> <?php $i = 0; while ($i < 5) { $i++; ?> <tr> <td style="text-align: center;"><?php echo $i . '.'; ?> </td> <?php $id_child = $childs[$i]; $emplo_child = EmployeeChildsPeer::retrieveByPK($id_child); ?> <td><?php echo $emplo_child ? $emplo_child->getName() ? $emplo_child->getName() : '' : ''; ?> </td> <td> <?php echo $emplo_child ? $emplo_child->getPob() ? $emplo_child->getPob() . ', ' : '' : ''; ?> <?php echo $emplo_child ? $emplo_child->getDob() ? DateToIndo($emplo_child->getDob()) : '' : ''; ?> </td> <td>
public function executeDeleteChilds() { $employee_childs = EmployeeChildsPeer::retrieveByPK($this->getRequestParameter('id')); $this->forward404Unless($employee_childs); $ref_error = 0; foreach ($employee_childs->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $employee_childs->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('user_profile_l/deleteChilds/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('user_profile_l/deleteChilds?employee_id=' . $employee_childs->getEmployeeId(), '_ERR_DELETE_ (' . $employee_childs->toString() . ' - id:' . $employee_childs->getId() . ')'); } else { $employee_childs->delete(); } return $this->forward('user_profile_l', 'listChilds'); }