Nette Documentation Preview

syntax
Migrating to Version 4.0
************************

.[note]
Version 4.0 is still under development and this page is a work in progress.

The minimum required PHP version is 8.3.


Nette Component Model
=====================

Most changes affect only authors of custom components; ordinary application code is unaffected. See the [release blog post |https://blog.nette.org/en/nette-component-model-4-0] for the full story.

- The `getComponents()` method no longer accepts the `$deep` and `$filterType` parameters and always returns an array of the direct children. For the whole subtree use `getComponentTree()`, optionally combined with `array_filter()` for type filtering.
- Attach notifications are now delivered top-down: a parent's `$attached` callback runs before its children's, which lets the parent prepare its state or even remove a child before it is processed. The detachment order is unchanged (children first).
- The overridable `attached()` and `detached()` methods were removed; register callbacks via `monitor($type, $attached, $detached)` instead.
- The `Component` class no longer uses the `Nette\SmartObject` trait, so magic property access is gone from the base class (`Control` and `BaseControl` add the trait themselves).
- The `NAME_SEPARATOR` constant was renamed to `NameSeparator`.

Migrating to Version 4.0

Version 4.0 is still under development and this page is a work in progress.

The minimum required PHP version is 8.3.

Nette Component Model

Most changes affect only authors of custom components; ordinary application code is unaffected. See the release blog post for the full story.

  • The getComponents() method no longer accepts the $deep and $filterType parameters and always returns an array of the direct children. For the whole subtree use getComponentTree(), optionally combined with array_filter() for type filtering.
  • Attach notifications are now delivered top-down: a parent's $attached callback runs before its children's, which lets the parent prepare its state or even remove a child before it is processed. The detachment order is unchanged (children first).
  • The overridable attached() and detached() methods were removed; register callbacks via monitor($type, $attached, $detached) instead.
  • The Component class no longer uses the Nette\SmartObject trait, so magic property access is gone from the base class (Control and BaseControl add the trait themselves).
  • The NAME_SEPARATOR constant was renamed to NameSeparator.