SceneHandlerWrapper
in package
Wraps a scene instance-method handler into a callable suitable for registration with a `TelegramEventObserver`.
Mirrors SceneHandlerWrapper (aiogram/fsm/scene.py:235-294).
Responsibilities:
- Extract
state(FsmContext) andscenes(ScenesManager) from the dispatcher kwargs bag; throwSceneExceptionif either is missing. - Instantiate the scene class with a fresh
SceneWizardbound to the current event context. - Call the wrapped handler method on the scene instance.
- If an
Afteraction was specified, execute it via the wizard.
The event_update field is not required in the PHP port — the update type
is injected directly into ScenesManager by SceneRegistry middleware
before SceneHandlerWrapper::__invoke is called. When event_update is
absent we default to 'message' for robustness.
Table of Contents
Properties
- $after : After|null
- $handler : callable
- $sceneClass : Scene>
Methods
- __construct() : mixed
- __invoke() : mixed
- Invoke the wrapped handler.
- executeAfter() : void
- Execute an `After` action via the scene wizard.
Properties
$after read-only
private
After|null
$after
= null
$handler read-only
private
callable
$handler
$sceneClass read-only
private
Scene>
$sceneClass
Methods
__construct()
public
__construct(Scene> $sceneClass, callable $handler[, After|null $after = null ]) : mixed
Parameters
- $sceneClass : Scene>
-
The scene class to instantiate.
- $handler : callable
-
The unbound handler method (receives
$sceneas the first argument). - $after : After|null = null
-
Optional post-handler action.
__invoke()
Invoke the wrapped handler.
public
__invoke(object $event, mixed ...$kwargs) : mixed
Mirrors SceneHandlerWrapper.__call__ (aiogram/fsm/scene.py:246-284).
Parameters
- $event : object
- $kwargs : mixed
Tags
executeAfter()
Execute an `After` action via the scene wizard.
private
executeAfter(SceneWizard $wizard, After $after) : void
Mirrors ActionContainer.execute (aiogram/fsm/scene.py:187-195).
Parameters
- $wizard : SceneWizard
- $after : After