Wizard Help

Step Event

The Step event is raised when the Wizard processes a step.

The event is raised at least twice for each step processed:

  • When the form is first rendered; request method is GET

  • When the form is submitted; request method is POST

It the form contains errors the event is raised again on subsequent form submissions.

Methods

Name

Description

__construct()

Event constructor

getBranches()

Returns a map defining which branches are enabled and/or disabled

getData()

Returns data for the current step

getGoto()

Returns a value indicating which step Wizard is to process next

getResponse()

Returns the response

getWizard()

Returns the Wizard instance that raised the event

hasData()

Returns a value indicating if the event contains data for the current step

isPropagationStopped()

Returns a value indicating whether event propagation is stopped

isWizardStopped()

Returns a value indicating whether the wizard is stopped

setBranches()

Set which branches are enabled and/or disabled

setData()

Set the data for the current step

setGoto()

Set the step that Wizard should process next

setResponse()

Sets the response

stopPropagation()

Stops event propagation

stopWizard()

Stops the wizard

Method Details

__construct()

Constructor

public function __construct(private WizardInterface $wizard)

Parameter

Type

Default

Description

$wizard

WizardInterface

Required

The Wizard instance that raised the event

getBranches()

Returns a map that defines which branches are enabled and/or disabled.

See also:

public function getBranches(): array

Return

array[string => Wizard::BRANCH_DISABLED | Wizard::BRANCH_ENABLED]

getData()

Returns the data for the current step.

See also:

public function getData(): array

Return

array

Data that has been set

getGoto()

Return which step Wizard is to process next.

See also:

public function getGoto(): int|string

Return

int|string

Which step the Wizard process next


Wizard::DIRECTION_BACKWARD - the previous step


Wizard::DIRECTION_FORWARD - the next step


Wizard::DIRECTION_REPEAT - repeat the current step


string: the name of the next step to process

getResponse()

Returns the response.

See also:

public function getResponse(): ?ResponseInterface

Return

?ResponseInterface

The response or null if no response is set

getWizard()

Returns the Wizard instance that raised the event.

public function getWizard(): WizardInterface

Return

WizardInterface

The Wizard instance that raised the event

hasData()

See also:

public function hasData(): bool

Return

bool

Whether the event contains data

isPropagationStopped()

Returns a value indicating whether event propagation is stopped.

See also:

public function isPropagationStopped(): bool

Return

bool

Whether event propagation is stopped


false: if event propagation is not stopped


true: if event propagation is stopped

isWizardStopped()

Returns a value indicating whether the Wizard is stopped

See also:

public function isWizardStopped(): bool

Return

bool

Whether the Wizard is stopped


false: if the Wizard is not stopped


true: if the Wizard is stopped

setBranches()

See also:

public function setBranches(array $branches): void

Parameter

Type

Default

Description

$branches

array

Required

A map that defines which branches are enabled and/or disabled


Keys are branch names


Values are either Wizard::BRANCH_DISABLED or Wizard::BRANCH_ENABLED

setData()

Set the data for the current step.

See also:

public function setData(mixed $data): void

Parameter

Type

Default

Description

$data

mixed

Required

The data

setGoto()

Set which step the Wizard should process next.

See also:

public function setGoto(int|string $goto): void

Parameter

Type

Default

Description

$goto

int|string

Wizard::DIRECTION_FORWARD

Which step the Wizard process next


Wizard::DIRECTION_BACKWARD - the previous step


Wizard::DIRECTION_FORWARD - the next step


Wizard::DIRECTION_REPEAT - repeat the current step


string: the name of the next step to process

setResponse()

Sets the response.

See also:

public function setResponse(ResponseInterface $response): self

Parameter

Type

Default

Description

$response

ResponseInterface

Required

The response

stopPropagation()

Stops event propagation.

See also: isPropagationStopped()

public function stopPropagation(): void

stopWizard()

Stops the Wizard.

See also:

public function stopWizard(): void
Last modified: 27 January 2025