public function editRecord(Record $newRecord) { if ($newRecord->isRunning()) { foreach ($this->getCurrentRecords() as $running) { $running->stop(); } } $record = $this->editEntry('Record', $newRecord); if ($record) { Mapper::commit(); } return $record; }
public function editRecord($id, $activity, $category, $tags, $text, $start, $end) { if ($id) { $record = $this->prm->getRecord($id); } else { $record = new Record($this->prm->getCurrentUser()); } $start = (new \DateTime())->setTimestamp($start); $end = is_null($end) ? null : (new \DateTime())->setTimestamp($end); $record->setStart($start); $record->setEnd($end); $record->setActivity($activity); $record->setCategory($category); $record->setTags($tags); $record->setText($text); return $this->convertRecord($this->prm->editRecord($record)); }