Dispatching

Dispatching is the process of loading a specific module and executing a specific action with given parameters. The dispatcher is essentially a middleman - it is a way to decouple the Request and URL Router from having to know how to load and execute modules. It is also a convenient way to perform Hierarchical MVC sub-requests on demand. The equivalent command in English might sound something like "load this module, run this action with these parameters, and return the result".

Dispatching in Alloy is done from the Kernel object. Any Controller, view template, or other object that has access to the Kernel can perform a dispatch to execute and return a module action result.

Dispatch Methods

In Alloy, there are two different types of dispatches, and two primary ways the dispatcher can be invoked. The primary and most common way the dispatcher is invoked is through mapping a specific URL to a named module and action with the URL Router. The bootstrap file takes the module and action parsed from the matched URL route and runs them through the dispatcher to execute them, which then returns the response from the module's Controller method.

dispatchRequest($module [, $action, array $params])

Primary dispatch method that is run for direct web requests. Using this dispatch method will do two things:

  1. Resolve the given named action to it's appropriate Controller method based on the request context. An example is when the URL route determines that the "Events" module should be loaded and the "index" action should be called. This translates to the "Module\Events\Controller" object being instantiated and the "indexAction" method being executed.
     
  2. Pass in the Request object instance as the first parameter. When the "indexAction" method is executed, it looks more like "indexAction($request)". Any other parameters specified by calling this method directly will be set on the Request object instance. The Request object is the only argument that will be passed in order to maintain the same interface that direct HTTP requests operate on.

            
# Will resolve this as 'indexAction($request)' echo $kernel->dispatchRequest('Events_Recommended', 'index'); # Will resolve this as 'indexAction($request, $lat, $lon)' echo $kernel->dispatchRequest('Restaurants_Nearby', 'index', array($event->lat, $event->lon));

          

dispatch($module, $action [, array $params])

Direct dispatch method for exact module + action + params dispatching. This method does not make any attempt to translate the dispatch request or add in any extra parameters.


            
# Raw, direct internal request. No modifications are made. echo $kernel->dispatch('Reviews', 'listForType', array('event', $event->id));

          

Transaksi Cepat dan Mudah di Slot 5k dengan Metode Pembayaran Beragam

Dengan deposit minimal hanya 5k, transaksi di Slot 5k bisa dilakukan dengan cepat dan mudah. Banyak situs menawarkan berbagai metode pembayaran seperti e-wallet dan bank transfer, serta pembayaran instan menggunakan QRIS, yang memungkinkan pemain untuk melakukan transaksi dalam hitungan detik.

Selain menawarkan gameplay yang menarik, Mahjong Ways juga dikenal karena volatilitasnya yang seimbang, memberikan kesempatan yang baik bagi pemain untuk memenangkan hadiah besar tanpa terlalu mengandalkan keberuntungan semata. Keberadaan fitur-fitur inovatif dalam permainan ini, seperti putaran gratis yang dapat diperoleh dengan simbol tertentu, semakin meningkatkan daya tarik Mahjong Ways di kalangan para pemain slot. Dalam setiap putaran, pemain merasa tertantang untuk mencari kombinasi simbol yang tepat yang dapat menghasilkan kemenangan. Mahjong Ways terus menjadi salah satu permainan slot yang paling dicari, dengan banyak pemain yang kembali lagi untuk merasakan sensasi permainan ini.

Dalam dunia perjudian online, Slot Toto menjadi salah satu permainan yang paling diminati. Dengan kombinasi fitur menarik dan jackpot progresif, permainan ini menawarkan pengalaman bermain yang seru dan menguntungkan. Banyak pemain yang berhasil mendapatkan kemenangan besar hanya dengan modal kecil di slot toto.

Slot 777 Pengalaman Bermain Seru dan Penuh Tantangan

Slot 777 menyediakan pengalaman bermain yang seru dan penuh tantangan. Dengan berbagai pilihan permainan dan fitur menarik, platform ini memberikan peluang menang yang lebih besar bagi para pemain yang ingin meraih kemenangan besar.

Pilihan Favorit untuk Menang Besar dengan Pasaran Lengkap

Toto Togel merupakan pilihan favorit para pemain yang mencari kesempatan besar untuk menang. Dengan pasaran yang lengkap dan selalu diperbarui, situs ini memberikan peluang tinggi bagi pemain untuk memperoleh angka yang tepat dan memenangkan hadiah besar.

Keluaran Macau memberikan informasi yang sangat dibutuhkan oleh para pemain togel yang sedang mencari angka jitu. Setiap angka yang keluar di Keluaran Macau selalu menjadi topik pembicaraan hangat di kalangan penggemar togel.

Related Links