Skip to content

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

Merged
mvorisek merged 10 commits intodevelopfrom
no_implicit_app
Jan 13, 2023
Merged

Drop AbstractView::initDefaultApp and App::init methods#1968
mvorisek merged 10 commits intodevelopfrom
no_implicit_app

Conversation

@mvorisek
Copy link
Copy Markdown
Member

@mvorisek mvorisek commented Jan 11, 2023

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().

@mvorisek mvorisek force-pushed the no_implicit_app branch 4 times, most recently from b531f60 to 23a9ce7 Compare January 12, 2023 10:01
@mvorisek mvorisek marked this pull request as ready for review January 13, 2023 20:48
@mvorisek mvorisek changed the title Drop AbstractView::initDefaultApp method Drop AbstractView::initDefaultApp and App::init methods Jan 13, 2023
$item = Factory::factory([View::class], ['name' => false, 'ui' => 'item', 'content' => $item]);
}

$item->setApp($this->getApp());
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in theory, app can be already set if an object with an app preset is passed

@mvorisek mvorisek merged commit 3ea4884 into develop Jan 13, 2023
@mvorisek mvorisek deleted the no_implicit_app branch January 13, 2023 21:24
@mkrecek234
Copy link
Copy Markdown
Contributor

@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
Copy link
Copy Markdown
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants