Skip to content

Commit 4690e26

Browse files
committed
Utilize modes and application initialization
1 parent 1b63b48 commit 4690e26

File tree

1 file changed

+37
-15
lines changed

1 file changed

+37
-15
lines changed

2. Request Flow Processing/1. Utilize modes and application initialization.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
- configure autoloader - PSR-4 prepend generation\Magento
1111

12-
\Magento\Framework\App\Bootstrap::*createApplication*
12+
[\Magento\Framework\App\Bootstrap](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Bootstrap.php)::*createApplication*
1313

1414
- just call object manager->create
1515

16-
\Magento\Framework\App\Bootstrap::*run*
16+
[\Magento\Framework\App\Bootstrap](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Bootstrap.php)::*run*
1717

1818
- set error handler
1919
- assert maintenance
@@ -27,7 +27,7 @@
2727

2828
### Application class
2929

30-
bootstrap->createApplication()
30+
[bootstrap->createApplication()](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Bootstrap.php#L230)
3131

3232
- [\Magento\Framework\App\Http](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Http.php) - index.php, pub/index.php
3333
load config area by front name
@@ -64,19 +64,26 @@ Notes:
6464
[\Magento\Framework\App\Http::launch](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Http.php#L128)
6565
1. detect config area by front name
6666

67-
`\Magento\Framework\App\AreaList` - areas from argument di.xml
67+
```php
68+
<?php
69+
$areaCode = $this->_areaList->getCodeByFrontName($this->_request->getFrontName());
70+
$this->_state->setAreaCode($areaCode);
71+
$this->_objectManager->configure($this->_configLoader->load($areaCode));
72+
```
73+
74+
`\Magento\Framework\App\AreaList` - areas from argument di.xml ([AreaList](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/AreaList.php))
6875

6976
- frontend = [frontname null, router "standard"] --- *default when nothing matched*
7077
- adminhtml - [frontNameResolver=..., router "admin"]
71-
\Magento\Backend\App\Area\FrontNameResolver::getFrontName(checkhost)
78+
[\Magento\Backend\App\Area\FrontNameResolver::getFrontName(checkhost)](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Backend/App/Area/FrontNameResolver.php#L83)
7279
system config `admin/url/use_custom`, `admin/url/custom`
7380
- crontab = null
7481
- webapi_rest = [frontName `/rest`]
7582
- webapi_soap = [frontname `/soap`]
7683

77-
1. ObjectManagerInterface::configure - selected area code
78-
1. result = FrontControllerInterface->dispatch
79-
1. ResultInterface.renderResult into response object
84+
1. [ObjectManagerInterface->configure()](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/ObjectManager/ObjectManager.php#L82) - selected area code
85+
1. result = FrontControllerInterface->dispatch()
86+
1. [ResultInterface->renderResult()](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/AbstractResult.php#L122) into response object
8087
1. event `controller_front_send_response_before` (request, response)
8188

8289

@@ -95,7 +102,7 @@ Notes:
95102
- "webapi_rest (frontName `/rest`) - preference module-webapi/etc/webapi_rest/di.xml - *\Magento\Webapi\Controller\Rest*
96103
- "webapi_soap" (frontname `/soap`) - preference module-webapi/etc/webapi_rest/di.xml - *\Magento\Webapi\Controller\Soap*
97104

98-
### [App\FrontController](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/FrontController.php):
105+
### [\Magento\Framework\App\FrontController](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/FrontController.php):
99106

100107
- routerList
101108
- action = router[].match
@@ -111,17 +118,32 @@ Notes:
111118

112119
- [\Magento\Framework\Controller\ResultInterface](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/ResultInterface.php) - renderResult, setHttpResponseCode, setHeader
113120

114-
Raw, Json, Forward, Layout, Page, Redirect
121+
Implementations:
122+
- [Result\Raw](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Raw.php) -> Result\AbstractResult
123+
- [Result\Json](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Json.php) -> Result\AbstractResult
124+
- [Result\Forward](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Forward.php) -> Result\AbstractResult
125+
- [\Magento\Framework\View\Result\Layout](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/View/Result/Layout.php) -> Result\AbstractResult
126+
- [\Magento\Framework\View\Result\Page](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/View/Result/Page.php) -> \Magento\Framework\View\Result\Layout
127+
- [Controller\Result\Redirect](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Controller/Result/Redirect.php) -> Result\AbstractResult
128+
129+
- [\Magento\Framework\App\ResponseInterface](https://github.com/magento/magento2/blob/2.2-develop/lib/internal//Magento/Framework/App/ResponseInterface.php) - sendResponse
115130

116-
- \Magento\Framework\App\ResponseInterface - sendResponse
117-
Console\Response, Response\FileInterface, PhpEnvironment\Response, Webapi\Response, Rest\Response
131+
Implementations:
132+
- [Console\Response](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/App/Console/Response.php)
133+
- [\Magento\MediaStorage\Model\File\Storage\FileInterface](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/MediaStorage/Model/File/Storage/Response.php) -> \Magento\Framework\App\Response\Http
134+
- [\Magento\Framework\HTTP\PhpEnvironment\Response](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php) -> \Zend\Http\PhpEnvironment\Response
135+
- [\Magento\Framework\Webapi\Response](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Webapi/Response.php) -> \Magento\Framework\HTTP\PhpEnvironment\Response
136+
- [\Magento\Framework\Webapi\Rest\Response](https://github.com/magento/magento2/blob/2.2-develop/lib/internal/Magento/Framework/Webapi/Rest/Response.php) -> \Magento\Framework\Webapi\Response
118137

119-
### [Controller\Rest](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/Controller/Rest.php):
120-
- process path [/$store]/... - specific store, [/all]/... - admin store, /... - default store
138+
### [\Magento\Webapi\Controller\Rest](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/Controller/Rest.php) -> \Magento\Framework\App\FrontControllerInterface:
139+
140+
- preference for FrontController set in [etc/webapi_rest/di.xml](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/etc/webapi_rest/di.xml#L32)
141+
- process path [/$store]/... - specific store, [/all]/... - admin store (0), /... - default store
121142
- a. process schema request /schema
122143
- b. or process api request (resolve route, invoike route -> service class with params)
123144

124-
### [Controller\Soap](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/Controller/Soap.php):
145+
### [\Magento\Webapi\Controller\Soap](https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Webapi/Controller/Soap.php) -> \Magento\Framework\App\FrontControllerInterface:
146+
125147
- process path (same as REST)
126148
- a. generate WSDL ?wsdl
127149
- b. or generate WSDL service list ?wsdl_list

0 commit comments

Comments
 (0)