From 37e2db1743696e4bb21b3381763fe09f1be24491 Mon Sep 17 00:00:00 2001 From: buddh4 Date: Wed, 11 Nov 2020 13:48:08 +0100 Subject: [PATCH 1/2] Fixed misleading phpDoc in LegacyStreamTrait.php --- protected/humhub/modules/stream/actions/LegacyStreamTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protected/humhub/modules/stream/actions/LegacyStreamTrait.php b/protected/humhub/modules/stream/actions/LegacyStreamTrait.php index 78cd1d2c51..b68a6115fd 100644 --- a/protected/humhub/modules/stream/actions/LegacyStreamTrait.php +++ b/protected/humhub/modules/stream/actions/LegacyStreamTrait.php @@ -194,12 +194,12 @@ trait LegacyStreamTrait $this->setupFilters(); } /** - * @deprecated since 1.7 use afterStreamQueryBuild + * @deprecated since 1.7 use Stream::beforeApplyFilters() */ public function setupCriteria(){} /** - * @deprecated since 1.7 use afterStreamQueryBuild + * @deprecated since 1.7 use Stream::beforeApplyFilters() */ public function setupFilters(){ } From 4e3a9b631333bc58c92a8c04a2ea0ab1a13b73df Mon Sep 17 00:00:00 2001 From: buddh4 Date: Wed, 11 Nov 2020 13:52:28 +0100 Subject: [PATCH 2/2] Improved Stream::afterApplyFilters() and Stream::beforeApplyFilters() phpDocs --- .../humhub/modules/stream/actions/Stream.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/protected/humhub/modules/stream/actions/Stream.php b/protected/humhub/modules/stream/actions/Stream.php index 5742043182..0634d082a4 100644 --- a/protected/humhub/modules/stream/actions/Stream.php +++ b/protected/humhub/modules/stream/actions/Stream.php @@ -245,6 +245,17 @@ abstract class Stream extends Action * At this point the StreamQuery has already been loaded with request data. * Subclasses may overwrite this function in order to do some last settings on the StreamQuery instance. * + * When overriding this method, make sure you call the parent implementation like the following: + * + * ```php + * public function beforeApplyFilters() + * { + * // Add some filters here + * + * parent::beforeApplyFilters(); + * } + * ``` + * * When overriding this method, make sure you call the parent implementation at the beginning of your function. * @throws \yii\base\InvalidConfigException */ @@ -277,6 +288,17 @@ abstract class Stream extends Action * most StreamQuery settings as filters won't have any effect. Since the query is not yet executed the * StreamQuery->query() can still be used for custom query conditions. * + * When overriding this method, make sure you call the parent implementation like the following: + * + * ```php + * public function afterApplyFilters() + * { + * // Manipulate query... + * + * parent::afterApplyFilters(); + * } + * ``` + * * When overriding this method, make sure you call the parent implementation at the beginning of your function. */ protected function afterApplyFilters()