From 847356d62f446a074eb10596316cc82944c5790f Mon Sep 17 00:00:00 2001 From: tomofu74 Date: Mon, 15 Jun 2020 14:02:01 +0900 Subject: [PATCH] Registration Events sample may occur type error. It was seen on my work developping "regtist_hubspot" module. ~~~ TypeError: Argument 1 passed to \humhub\modules\regist_hubspot\Events::onUserRegistration() must be an instance of \humhub\modules\regist_hubspot\UserEvent, instance of yii\web\UserEvent given in C:\xampp\htdocs\humhubcom\protected\modules\regist_hubspot\Events.php:29 Stack trace: #0 [internal function]: \humhub\modules\regist_hubspot\Events::onUserRegistration(Object(yii\web\UserEvent)) #1 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\Event.php(312): call_user_func(Array, Object(yii\web\UserEvent)) #2 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\Component.php(636): yii\base\Event::trigger('humhub\\modules\\...', 'afterRegistrati...', Object(yii\web\UserEvent)) #3 C:\xampp\htdocs\humhubcom\protected\humhub\modules\user\models\forms\Registration.php(282): yii\base\Component->trigger('afterRegistrati...', Object(yii\web\UserEvent)) #4 C:\xampp\htdocs\humhubcom\protected\humhub\modules\user\controllers\RegistrationController.php(73): humhub\modules\user\models\forms\Registration->register(NULL) #5 [internal function]: humhub\modules\user\controllers\RegistrationController->actionIndex() #6 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array) #7 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array) #8 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('', Array) #9 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('user/registrati...', Array) #10 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(humhub\components\Request)) #11 C:\xampp\htdocs\humhubcom\index.php(25): yii\base\Application->run() #12 {main} --- docs/develop/modules-event-handler.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/develop/modules-event-handler.md b/docs/develop/modules-event-handler.md index c473f82..14b5a28 100644 --- a/docs/develop/modules-event-handler.md +++ b/docs/develop/modules-event-handler.md @@ -424,7 +424,7 @@ return [ ```php // Event.php -public static function onUserRegistration(UserEvent $event) +public static function onUserRegistration($event) { try { $service = new CrmService(); @@ -627,4 +627,4 @@ public static function onSpecialWidgetBeforeRun(WidgetCreateEvent $event) Since the widget is created by a call to `Yii::createObject()` the new widget class has to be compatible with the overwritten one, which means it has to support all possible properties of the original widget class. This could be achieved by extending the original widget. -::: \ No newline at end of file +:::