atk4 / ui

Robust and easy to use PHP Framework for Web Apps
https://atk4-ui.readthedocs.io
MIT License
440 stars 105 forks source link

Drop AbstractView::initDefaultApp and App::init methods #1968

Closed mvorisek closed 1 year ago

mvorisek commented 1 year ago

Creating many implicit apps can imply negative performance and/or unexpected (other than configured, like implicit UI persistence comma) behaviour, both hard to debug.

If you call View::invokeInit() manually (not recommended, but needed for edge cases), then you need to set the app manually before the call.

This PR also asserts app is set no later than in init, this requirement may be drop in the future, but currently it is needed to load a template which is defined in almost every View.

Also drop ExecutorFactory::create() method in favor of ExecutorFactory::createExecutor().

mkrecek234 commented 1 year ago

@mvorisek Using invokeInit heavily, how can I set app manually? My central app class is set using $app = new App and then $app->invokeInit() is called, as around 50 models require App Scope right away. What is the recommended solution for this BC-break?

mvorisek commented 1 year ago

there should be no or minimal BC break if you use App in Models