Stop using `TLegacyUserPropertyAccess` (and associated legacy `__get()`)
authorMatthias Schmidt <gravatronics@live.com>
Mon, 25 Jan 2021 15:05:43 +0000 (16:05 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 25 Jan 2021 15:05:43 +0000 (16:05 +0100)
Close #146

files/lib/data/conversation/ViewableConversation.class.php
files/lib/data/conversation/message/ViewableConversationMessage.class.php
files/lib/data/modification/log/ViewableConversationModificationLog.class.php

index 3d1877e7a122a5cf8739809da51df1d95856864c..165c2badbc7f2b59284c707e6586503ffb4fa7e9 100644 (file)
@@ -5,7 +5,6 @@ namespace wcf\data\conversation;
 use wcf\data\conversation\label\ConversationLabel;
 use wcf\data\conversation\label\ConversationLabelList;
 use wcf\data\DatabaseObjectDecorator;
-use wcf\data\TLegacyUserPropertyAccess;
 use wcf\data\user\User;
 use wcf\data\user\UserProfile;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
@@ -27,8 +26,6 @@ use wcf\system\WCF;
  */
 class ViewableConversation extends DatabaseObjectDecorator
 {
-    use TLegacyUserPropertyAccess;
-
     /**
      * participant summary
      * @var string
@@ -64,49 +61,6 @@ class ViewableConversation extends DatabaseObjectDecorator
      */
     protected static $baseClass = Conversation::class;
 
-    /**
-     * maps legacy direct access to last poster's user profile data to the real
-     * user profile property names
-     * @var string[]
-     * @deprecated
-     */
-    protected static $__lastUserAvatarPropertyMapping = [
-        'lastPosterAvatarID' => 'avatarID',
-        'lastPosterAvatarName' => 'avatarName',
-        'lastPosterAvatarExtension' => 'avatarExtension',
-        'lastPosterAvatarWidth' => 'width',
-        'lastPosterAvatarHeight' => 'height',
-        'lastPosterEmail' => 'email',
-        'lastPosterDisableAvatar' => 'disableAvatar',
-        'lastPosterEnableGravatar' => 'enableGravatar',
-        'lastPosterGravatarFileExtension' => 'gravatarFileExtension',
-        'lastPosterAvatarFileHash' => 'fileHash',
-    ];
-
-    /**
-     * @inheritDoc
-     * @deprecated
-     */
-    public function __get($name)
-    {
-        $value = parent::__get($name);
-        if ($value !== null) {
-            return $value;
-        } elseif (\array_key_exists($name, $this->object->data)) {
-            return;
-        }
-
-        /** @noinspection PhpVariableVariableInspection */
-        $value = $this->getUserProfile()->{$name};
-        if ($value !== null) {
-            return $value;
-        }
-
-        if (isset(static::$__lastUserAvatarPropertyMapping[$name])) {
-            return $this->getLastPosterProfile()->getAvatar()->{static::$__lastUserAvatarPropertyMapping[$name]};
-        }
-    }
-
     /**
      * Returns the user profile object.
      *
index e5023ed9690b0712dea0a31471de3d694fbdf219..2315d46bbba80d3eecddf200df59c7f996cb8b88 100644 (file)
@@ -3,7 +3,6 @@
 namespace wcf\data\conversation\message;
 
 use wcf\data\DatabaseObjectDecorator;
-use wcf\data\TLegacyUserPropertyAccess;
 use wcf\data\user\UserProfile;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 
@@ -20,8 +19,6 @@ use wcf\system\cache\runtime\UserProfileRuntimeCache;
  */
 class ViewableConversationMessage extends DatabaseObjectDecorator
 {
-    use TLegacyUserPropertyAccess;
-
     /**
      * @inheritDoc
      */
index e74541247b349eed00ef49279a13f1581cc960b5..210e1e590eac93998cd0d78d02e84ba603864344 100644 (file)
@@ -3,7 +3,6 @@
 namespace wcf\data\modification\log;
 
 use wcf\data\DatabaseObjectDecorator;
-use wcf\data\TLegacyUserPropertyAccess;
 use wcf\data\user\UserProfile;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\WCF;
@@ -21,8 +20,6 @@ use wcf\system\WCF;
  */
 class ViewableConversationModificationLog extends DatabaseObjectDecorator
 {
-    use TLegacyUserPropertyAccess;
-
     /**
      * @inheritDoc
      */