added multi-select for customer, project and activity (#1557)

This commit is contained in:
Kevin Papst
2020-03-16 14:06:26 +01:00
committed by GitHub
parent 6eeb01ad48
commit 4b1cfa5840
74 changed files with 1262 additions and 754 deletions

View File

@@ -32,9 +32,9 @@ class TimesheetQuery extends ActivityQuery
*/
protected $timesheetUser;
/**
* @var Activity|null
* @var array
*/
protected $activity;
private $activities = [];
/**
* @var int
*/
@@ -114,26 +114,66 @@ class TimesheetQuery extends ActivityQuery
}
/**
* Activity overwrites: setProject() and setCustomer()
*
* @return Activity|null
* @return Activity|int|null
* @deprecated since 1.9 - use getProjects() instead - will be removed with 2.0
*/
public function getActivity()
{
return $this->activity;
if (count($this->activities) > 0) {
return $this->activities[0];
}
return null;
}
public function getActivities(): array
{
return $this->activities;
}
/**
* @param Activity|int|null $activity
* @return TimesheetQuery
* @return $this
* @deprecated since 1.9 - use setActivities() or addActivity() instead - will be removed with 2.0
*/
public function setActivity($activity = null)
public function setActivity($activity)
{
$this->activity = $activity;
if (null === $activity) {
$this->activities = [];
} else {
$this->activities = [$activity];
}
return $this;
}
/**
* @param Activity|int $activity
* @return $this
*/
public function addActivity($activity)
{
$this->activities[] = $activity;
return $this;
}
/**
* @param Activity[]|int[] $activities
* @return $this
*/
public function setActivities(array $activities)
{
$this->activities = $activities;
return $this;
}
public function hasActivities(): bool
{
return !empty($this->activities);
}
/**
* @return int
*/