From 777fa8ffad70222df6df437e8ec4436272572d11 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 11 Jan 2023 18:47:12 +0100 Subject: [PATCH] user displayname --- .../DatabaseEntity/Attribute/MultipleReference.class.php | 2 +- Core/Objects/DatabaseEntity/User.class.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Core/Objects/DatabaseEntity/Attribute/MultipleReference.class.php b/Core/Objects/DatabaseEntity/Attribute/MultipleReference.class.php index 9fc21f2..ffa2ac5 100644 --- a/Core/Objects/DatabaseEntity/Attribute/MultipleReference.class.php +++ b/Core/Objects/DatabaseEntity/Attribute/MultipleReference.class.php @@ -12,7 +12,7 @@ class MultipleReference { private string $thisProperty; private string $relProperty; - public function __construct(string $className, string $thisProperty, string $relProperty) { + public function __construct(string $className, string $thisProperty, string $relProperty = "id") { $this->className = $className; $this->thisProperty = $thisProperty; $this->relProperty = $relProperty; diff --git a/Core/Objects/DatabaseEntity/User.class.php b/Core/Objects/DatabaseEntity/User.class.php index 068575f..e3c785c 100644 --- a/Core/Objects/DatabaseEntity/User.class.php +++ b/Core/Objects/DatabaseEntity/User.class.php @@ -137,4 +137,8 @@ class User extends DatabaseEntity { return false; } } + + public function getDisplayName(): string { + return !empty($this->fullName) ? $this->fullName : $this->name; + } } \ No newline at end of file