fix: avoid issues with missing user/teamer relation
This commit is contained in:
+11
-8
@@ -28,17 +28,20 @@ class AppRuntime implements RuntimeExtensionInterface
|
|||||||
public function teamerStatusLabel(Teamer $teamer): string
|
public function teamerStatusLabel(Teamer $teamer): string
|
||||||
{
|
{
|
||||||
$labelItems = [];
|
$labelItems = [];
|
||||||
|
$user = $teamer->getUser();
|
||||||
|
|
||||||
if ($teamer->getUser()->hasRole('ROLE_ADMIN')) {
|
if (null !== $user) {
|
||||||
$labelItems[] = 'Admin';
|
if ($user->hasRole('ROLE_ADMIN')) {
|
||||||
}
|
$labelItems[] = 'Admin';
|
||||||
|
}
|
||||||
|
|
||||||
if ($teamer->getUser()->hasRole('ROLE_MANAGER')) {
|
if ($user->hasRole('ROLE_MANAGER')) {
|
||||||
$labelItems[] = 'Reisemanagement';
|
$labelItems[] = 'Reisemanagement';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($teamer->getUser()->hasRole('ROLE_HOUSE_MANAGER')) {
|
if ($user->hasRole('ROLE_HOUSE_MANAGER')) {
|
||||||
$labelItems[] = 'Hausleitung';
|
$labelItems[] = 'Hausleitung';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < count($labelItems)) {
|
if (0 < count($labelItems)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user