create timesheet for multiple users (#1716)

This commit is contained in:
Kevin Papst
2020-05-18 23:35:43 +02:00
committed by GitHub
parent 9da46bbdcd
commit e61ffe4db4
20 changed files with 548 additions and 16 deletions

View File

@@ -557,6 +557,27 @@ class Timesheet implements EntityWithMetaFields, ExportItemInterface
return $this;
}
public function createCopy(?Timesheet $timesheet = null): Timesheet
{
if (null === $timesheet) {
$timesheet = new Timesheet();
}
$values = get_object_vars($this);
foreach ($values as $k => $v) {
$timesheet->$k = $v;
}
$timesheet->meta = new ArrayCollection();
/** @var TimesheetMeta $meta */
foreach ($this->meta as $meta) {
$timesheet->setMetaField(clone $meta);
}
return $timesheet;
}
public function __clone()
{
if ($this->id) {