/** * Save employee leave brought forward for given period * @param int $employeeId * @param int $leaveTypeId * @param int $leavePeriodId * @param float $broughtForwardLeaveLength * @return boolean */ public function saveEmployeeLeaveBroughtForward($employeeId, $leaveTypeId, $leavePeriodId, $broughtForwardLeaveLength) { try { $leaveEntitlement = $this->readEmployeeLeaveEntitlement($employeeId, $leaveTypeId, $leavePeriodId); if (!$leaveEntitlement instanceof EmployeeLeaveEntitlement) { $leaveEntitlement = new EmployeeLeaveEntitlement(); $leaveEntitlement->setLeaveTypeId($leaveTypeId); $leaveEntitlement->setLeavePeriodId($leavePeriodId); $leaveEntitlement->setEmployeeId($employeeId); $leaveEntitlement->setNoOfDaysAllotted(0); } $leaveEntitlement->setLeaveBroughtForward($broughtForwardLeaveLength); $leaveEntitlement->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }