/** * Saves a Jalon Mapper entry at storage layer level (insert or update) * @param Project_Model_Jalon $jalon * @throws Exception if update process failed * @return Project_Model_Jalon $jalon */ public function save(Project_Model_Jalon $jalon) { $jalonSave = new Project_Model_Mapper_Jalon(); if ((int) $jalon->getId() !== 0) { try { $jalonSave->update($jalon); return self::JALON_UPDATED; } catch (Exception $e) { return self::JALON_UPDATE_FAILED; } } else { try { $jalonSave->insert($jalon); return self::JALON_CREATED; } catch (Exception $e) { return self::JALON_CREATION_FAILED; } } }
private function _objectToRow(Project_Model_Jalon $jalon) { $jalonRow['jal_id'] = $jalon->getId(); $jalonRow['jal_name'] = $jalon->getName(); $jalonRow['jal_description'] = $jalon->getDescription(); $jalonRow['jal_date'] = $jalon->getDate(); $jalonRow['proj_id'] = $jalon->getProject()->getId(); return $jalonRow; }