Skip to content

Commit

Permalink
Registration Events sample may occur type error.
Browse files Browse the repository at this point in the history
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)) humhub#1 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\Event.php(312): call_user_func(Array, Object(yii\web\UserEvent)) humhub#2 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\Component.php(636): yii\base\Event::trigger('humhub\\modules\\...', 'afterRegistrati...', Object(yii\web\UserEvent)) humhub#3 C:\xampp\htdocs\humhubcom\protected\humhub\modules\user\models\forms\Registration.php(282): yii\base\Component->trigger('afterRegistrati...', Object(yii\web\UserEvent)) humhub#4 C:\xampp\htdocs\humhubcom\protected\humhub\modules\user\controllers\RegistrationController.php(73): humhub\modules\user\models\forms\Registration->register(NULL) humhub#5 [internal function]: humhub\modules\user\controllers\RegistrationController->actionIndex() humhub#6 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array) humhub#7 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array) humhub#8 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('', Array) humhub#9 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('user/registrati...', Array) humhub#10 C:\xampp\htdocs\humhubcom\protected\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(humhub\components\Request)) humhub#11 C:\xampp\htdocs\humhubcom\index.php(25): yii\base\Application->run() humhub#12 {main}
  • Loading branch information
tomofu74 committed Jun 15, 2020
1 parent ead0ea6 commit 847356d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/develop/modules-event-handler.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ return [

```php
// Event.php

This comment has been minimized.

Copy link
@ArchBlood

ArchBlood Jun 15, 2020

Use

     /**
     * @param \yii\base\Event $event
     */

not Event.php

public static function onUserRegistration(UserEvent $event)
public static function onUserRegistration($event)
{
try {
$service = new CrmService();
Expand Down Expand Up @@ -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.
:::
:::

0 comments on commit 847356d

Please sign in to comment.