Fix return type in user getters for mainScope and userJob

This commit is contained in:
2023-09-20 14:34:42 +02:00
parent 8a6f29ef79
commit d2feb0f0b4
5 changed files with 24 additions and 52 deletions

View File

@@ -262,7 +262,7 @@ class User implements UserInterface, \Stringable
return $this->mainLocation;
}
public function getMainScope(?DateTimeImmutable $at = null): ?UserScopeHistory
public function getMainScope(?DateTimeImmutable $at = null): ?Scope
{
$at ??= new DateTimeImmutable('today');
$criteria = new Criteria();
@@ -281,7 +281,7 @@ class User implements UserInterface, \Stringable
$scopes = $this->scopeHistories->matching($criteria);
if ($scopes->count() > 0) {
return $scopes->first();
return $scopes->first()->getScope();
}
return null;
@@ -305,7 +305,7 @@ class User implements UserInterface, \Stringable
return $this->salt;
}
public function getUserJob(?DateTimeImmutable $at = null): ?UserJobHistory
public function getUserJob(?DateTimeImmutable $at = null): ?UserJob
{
$at ??= new DateTimeImmutable('today');
$criteria = new Criteria();
@@ -317,13 +317,13 @@ class User implements UserInterface, \Stringable
$expr->isNull('endDate'),
$expr->gt('endDate', $at)
),
$expr->lte('startDate')
$expr->lte('startDate', $at)
)
);
$jobs = $this->jobHistories->matching($criteria);
if ($jobs->count() > 0) {
return $jobs->first();
return $jobs->first()->getJob();
}
return null;