added tags for timesheets (#604)
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace App\Calendar;
|
||||
|
||||
use App\Entity\Tag;
|
||||
use App\Entity\Timesheet;
|
||||
|
||||
class TimesheetEntity
|
||||
@@ -45,6 +46,10 @@ class TimesheetEntity
|
||||
* @var string
|
||||
*/
|
||||
protected $activity;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $tags;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
@@ -66,6 +71,14 @@ class TimesheetEntity
|
||||
$this->customer = $entry->getProject()->getCustomer()->getName();
|
||||
$this->project = $entry->getProject()->getName();
|
||||
$this->activity = $entry->getActivity()->getName();
|
||||
if (sizeof($entry->getTags()) > 0) {
|
||||
$arr = [];
|
||||
/** @var Tag $tag */
|
||||
foreach ($entry->getTags() as $tag) {
|
||||
array_push($arr, $tag->getName());
|
||||
}
|
||||
$this->tags = implode(', ', $arr);
|
||||
}
|
||||
|
||||
$color = $entry->getActivity()->getColor();
|
||||
if (empty($color)) {
|
||||
@@ -235,6 +248,25 @@ class TimesheetEntity
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTags(): ?string
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $tags
|
||||
* @return TimesheetEntity
|
||||
*/
|
||||
public function setTags(?string $tags)
|
||||
{
|
||||
$this->tags = $tags;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user