public function saveJosOrtherWork(JosOrtherWork $jos_orther_work) { $data = array('content' => $jos_orther_work->getContent(), 'user_id' => $jos_orther_work->getUserId(), 'year_id' => $jos_orther_work->getYearId(), 'time_from' => $jos_orther_work->getTimeFrom(), 'time_to' => $jos_orther_work->getTimeTo(), 'note' => $jos_orther_work->getNote()); $value_id = (int) $jos_orther_work->getValueId(); if ($value_id == 0) { $this->tableGateway->insert($data); } else { if ($this->getOrtherWorkByArrayConditionAndArrayColumns(array('value_id' => $value_id), array('user_id'))) { $this->tableGateway->update($data, array('value_id' => $value_id)); } else { return false; } } return true; }