Nette Documentation Preview

syntax
Upgrading
*********


Upgrading to Version 4.0
========================

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 now returns an `array` instead of an `iterable`, and its legacy `$deep` and `$filterType` arguments now throw `Nette\DeprecatedException`. They disappeared from the signature back in version 3.1, but kept working at runtime until now. 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 deprecated `NAME_SEPARATOR` constant was removed; use `NameSeparator`, available since version 3.0.3.


Upgrading to Version 3.0
========================

The constructor of `Nette\ComponentModel\Component` has not been used for years and was removed in version 3.0. It is a BC break: if you call the parent constructor in a component or presenter, you must remove the call.

Upgrading

Upgrading to Version 4.0

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 now returns an array instead of an iterable, and its legacy $deep and $filterType arguments now throw Nette\DeprecatedException. They disappeared from the signature back in version 3.1, but kept working at runtime until now. 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 deprecated NAME_SEPARATOR constant was removed; use NameSeparator, available since version 3.0.3.

Upgrading to Version 3.0

The constructor of Nette\ComponentModel\Component has not been used for years and was removed in version 3.0. It is a BC break: if you call the parent constructor in a component or presenter, you must remove the call.