zf2 でのイベントの実践について質問があります。ベスト プラクティスとして、オブジェクトを動的に注入するために、デフォルトで変更可能なインターフェイスを使用する必要があります。
しかし、イベントはどうですか?イベントは注入可能であるべきですか? たとえば、AuthenticationEvent 内の認証サービスです。AuthenticationEvent を直接呼び出すか、get/set 経由で呼び出す方がよいですか?
例:
$this->getEventManager()->trigger('auth_pre', __CLASS__, new AuthEvent($params));
また
$eventAuth = $this->getAuthEvent();
$eventAuth->setParams($params);
$this->getEventManager()->trigger('auth_pre', __CLASS__, $eventAuth);
よろしく