Skip to content

Incompatible with nette/component-model v4 — Wizard throws DeprecatedException on render #42

Description

@JanCern

Hi,

forms-wizard 4.1.0 is incompatible with nette/component-model v4.0. In v4 the getComponents() filter/recursive arguments were removed — passing them no longer just warns, it throws Nette\DeprecatedException:

Container::getComponents() parameters removed. The method now takes no arguments and returns a plain array of immediate children (previously iterable). The old recursive flag and filter-type argument are gone — passing them throws a DeprecatedException. For recursive traversal use getComponentTree() instead.

Wizard::applyCallbacksToButtons() still calls the old signature, so any wizard throws at render time:

// src/Wizard.php:368
foreach ($form->getComponents(false, SubmitButton::class) as $control) {

foreach ($form->getComponents(false, SubmitButton::class) as $control) {

Composer installs v4 silently, because the only constraint is conflict: "nette/component-model": "<3.0.3" (no upper bound).

Suggested fix — call getComponents() with no arguments and filter with instanceof (works on both v3 and v4):

foreach ($form->getComponents() as $control) {
    if (!$control instanceof SubmitButton) {
        continue;
    }
    // …
}

Environment: forms-wizard 4.1.0, nette/component-model 4.0.1, PHP 8.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions