public function saveJosFutureTeaching(JosFutureTeaching $jos_future_teaching) { $data = array('subject_id' => $jos_future_teaching->getSubjectId(), 'user_id' => $jos_future_teaching->getUserId(), 'lesson_number' => $jos_future_teaching->getLessonNumber(), 'qualifications' => $jos_future_teaching->getQualifications(), 'edu_system' => $jos_future_teaching->getEduSystem(), 'note' => $jos_future_teaching->getNote()); $value_id = (int) $jos_future_teaching->getValueId(); if ($value_id == 0) { $this->tableGateway->insert($data); } else { if ($this->getFutureTeachingByArrayConditionAndArrayColumns(array('value_id' => $value_id), array('user_id'))) { $this->tableGateway->update($data, array('value_id' => $value_id)); } else { return false; } } return true; }