{"action":"opened","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/11624","repository_url":"https://api.github.com/repos/yiisoft/yii2","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/11624/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/11624/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/11624/events","html_url":"https://github.com/yiisoft/yii2/issues/11624","id":156651197,"number":11624,"title":"How to set event handlers in modules, that depend one to another?","user":{"login":"yujin1st","id":2317913,"avatar_url":"https://avatars.githubusercontent.com/u/2317913?v=3","gravatar_id":"","url":"https://api.github.com/users/yujin1st","html_url":"https://github.com/yujin1st","followers_url":"https://api.github.com/users/yujin1st/followers","following_url":"https://api.github.com/users/yujin1st/following{/other_user}","gists_url":"https://api.github.com/users/yujin1st/gists{/gist_id}","starred_url":"https://api.github.com/users/yujin1st/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yujin1st/subscriptions","organizations_url":"https://api.github.com/users/yujin1st/orgs","repos_url":"https://api.github.com/users/yujin1st/repos","events_url":"https://api.github.com/users/yujin1st/events{/privacy}","received_events_url":"https://api.github.com/users/yujin1st/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-25T02:39:50Z","updated_at":"2016-05-25T02:39:50Z","closed_at":null,"body":"There are two modules that handle events of each others.\r\nWhere should handlers initialization be placed? \r\nYou get a recursion, if you place it in init section of module.\r\n\r\n ```php\r\n//module 1\r\npublic function init() {\r\n    parent::init();\r\n    if ($app->hasModule('module2')) {\r\n      $module = $app->getModule('module2');\r\n      $module->on('someModule2Event', function ($event) {\r\n        // do something\r\n      });\r\n  }\r\n //  the same in module 2\r\n``` "}}
{"actor":{"display_login":"yujin1st"}}