Presenter initialized twice

2 years ago

dkorpar
Member | 58
+
0
-

I've experienced problem with this code in presenter:

public function __construct(CustomControl $control1)
{
    //if ($control1->getParent() == NULL) {
    $this->addComponent($control1, 'custom');
    //}
}

I have to check if my control1 already has parent otherwise I get InvalidStateException (Component already have parent) When debugging I've set breakpoint in constructor and on submit (outside of control) presenter was initialized twice, when showing first time it was only once. Now I'm wondering is this a bug, or is it really expected behaviour to have presenter initialized 2 times in some ocassions? (Why?)

Or did I do something completely wrong?

Last edited by dkorpar (2017-01-30 15:04)