/** * 更新工作经历 * * @param id $id * @param PwWorkDm $dm * @return PwError|boolean|int */ public function editWorkExperience($id, $dm) { $uid = intval($dm->getField('uid')); if (($id = intval($id)) < 1 || $uid < 1) { return new PwError('USER:work.illegal.request'); } if (!$dm instanceof PwWorkDm) { return new PwError('USER:work.illegal.datatype'); } if (($result = $dm->beforeUpdate()) instanceof PwError) { return $result; } return $this->_getDao()->update($id, $uid, $dm->getData()); }
/** * 编辑工作经历 */ public function editAction() { $workDm = new PwWorkDm(); $workDm->setCompany($this->getInput('company', 'post')); $workDm->setStartTime($this->getInput('startYear', 'post'), $this->getInput('startMonth', 'post')); $workDm->setEndTime($this->getInput('endYear', 'post'), $this->getInput('endMonth', 'post')); $workDm->setUid($this->loginUser->uid); $workDs = $this->_getDs(); if (($result = $workDs->editWorkExperience($this->getInput('id', 'post'), $workDm)) instanceof PwError) { $this->showError($result->getError()); } $this->showMessage('USER:work.update.success'); }