- Backer | 152
Is this a bug or a feature?
In Nette\Application\UI\Presenter there is getGlobalState method that throws aforementioned notice (on line 1171) when I use my custom form control. The since variable seems to be uninitialized when $iterator->getDepth() doesn't evaluate to zero.
Simple $since = FALSE put inside the foreach solves the problem for me and everything works as expected but I am not sure if I miss something.
- Member | 1
I had the same problem. It appears when your custom form control implements interface Nette\Application\UI\IStatePersistent (usually when its inherited from Nette\Application\UI\Control or Nette\Application\UI\PresenterComponent), while its parent (Form) does not. In this case, the parent is filtered out and the $iterator contains only your component (with depth > 0) and not it's parents… IMO there are three possible solutions:
- rewrite your custom form control (get rid of Nette\Application\UI\PresenterComponent inheritance)
- use custom Form class that overrides \Nette\Application\UI\Form and implements Nette\Application\UI\IStatePersistent
- add “$since = null” line to Nette\Application\UI\Presenter (terrible solution) :-)