21

Their is a lot of fuss going about Magento 2, concept like Namespaces etc has been incorporated into it. I am just curious to know how REQUEST flow has been handled in Magento 2, can somebody give me a brief .

Interesting point from Anthol Krit Presentation

Magneto2 has got 8000 classes compare to 2700 in Magento 1

20

index.php creates application instance (\Magento\Framework\App\Http) using objectManager (that is created before that in bootstrap) and calls method launch.

Http Application instance does initial routing: it takes first part of url to figure out which area should be loaded (admin/frontend/rest/...).

When area is defined, configuration for that area is loaded (unlike Magento 1 where all configuration was loaded).

Then application object calls Magento\Framework\App\FrontControllerInterface::dispatch of requested area. Front Controller does routing same as in Magento 1: all routers are iterated to match request. The router that matches the request returns instance of ActionController matched to FrontController. This process is more efficient because only routers of one area are used (admin router is not used in frontend). All the extra behavior was moved from front controller to plugins of FrontController and Action Controllers.

When FrontController gets instance of action controller it calls dispatch on it. Action controller performs its task and returns instance of some implementation of ResultInterface (like page, redirect, ...).

FrontController just returns ResultInterface to Application Instance that renders the response.

I did presentation on this at Meet Magento NL: http://www.slideshare.net/Dutchento/anton-kril-mm15nl

  • Thnaks @anthon for your answer . – Dimag Kharab Jul 8 '15 at 13:05
  • 2
    Ill be taking much time to grasp the full concept it seems – Dimag Kharab Jul 8 '15 at 13:34
4

Check the below links. The request flow is defined very nicely.

http://www.dckap.com/blog/request-flow-in-magento-2/

http://brideo.co.uk/magento2/Request-Flow-In-Magento-2/

3

Here are a few resources on the topic for anybody who is interested:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.