Nette Component Model 2.4 – deprecated constructor parameters
- David Grudl
- Nette Core | 8218
Nette Component Model v2.4 triggers a deprecation notice when you pass
parameters $parent, $name
to constructor. (It is long years planned
BC break for v3.0).
It affects use cases like this:
function createComponentGrid()
{
$grid = new DataGrid($this, 'grid');
...
}
If you want your component to continue supporting these parameters, add the custom constructor
Users can use workaround:
function createComponentGrid()
{
$grid = $this['grid'] = new DataGrid;
...
}
or eventually
function createComponentGrid()
{
$grid = new DataGrid;
...
return $grid;
}
For experts: since 2.4 is prefered way to use callbacks in
monitor($type, callable $attached = null, callable $detached = null
)
over method attached() resp. detached(). See example,
and documentation