API methods to handle teams and users (#1384)
This commit is contained in:
@@ -144,6 +144,11 @@ class Team
|
||||
return $this->users;
|
||||
}
|
||||
|
||||
public function hasCustomer(Customer $customer): bool
|
||||
{
|
||||
return $this->customers->contains($customer);
|
||||
}
|
||||
|
||||
public function addCustomer(Customer $customer)
|
||||
{
|
||||
if ($this->customers->contains($customer)) {
|
||||
@@ -172,6 +177,11 @@ class Team
|
||||
return $this->customers;
|
||||
}
|
||||
|
||||
public function hasProject(Project $project): bool
|
||||
{
|
||||
return $this->projects->contains($project);
|
||||
}
|
||||
|
||||
public function addProject(Project $project)
|
||||
{
|
||||
if ($this->projects->contains($project)) {
|
||||
|
||||
@@ -266,6 +266,27 @@ class User extends BaseUser implements UserInterface
|
||||
return $this->getPreferenceValue(UserPreference::TIMEZONE, date_default_timezone_get());
|
||||
}
|
||||
|
||||
public function getLanguage(): string
|
||||
{
|
||||
return $this->getLocale();
|
||||
}
|
||||
|
||||
public function setLanguage(?string $language)
|
||||
{
|
||||
if ($language === null) {
|
||||
$language = User::DEFAULT_LANGUAGE;
|
||||
}
|
||||
$this->setPreferenceValue(UserPreference::LOCALE, $language);
|
||||
}
|
||||
|
||||
public function setTimezone(?string $timezone)
|
||||
{
|
||||
if ($timezone === null) {
|
||||
$timezone = date_default_timezone_get();
|
||||
}
|
||||
$this->setPreferenceValue(UserPreference::TIMEZONE, $timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $default
|
||||
|
||||
Reference in New Issue
Block a user