Class Phalcon\Mvc\Application

extends abstract class Phalcon\Di\Injectable

implements Phalcon\Events\EventsAwareInterface, Phalcon\Di\InjectionAwareInterface

This component encapsulates all the complex operations behind instantiating every component needed and integrating it with the rest to allow the MVC pattern to operate as desired.

  1. <?php
  2. class Application extends \Phalcon\Mvc\Application
  3. {
  4. /**
  5. * Register the services here to make them general or register
  6. * in the ModuleDefinition to make them module-specific
  7. */
  8. protected function _registerServices()
  9. {
  10. }
  11. /**
  12. * This method registers all the modules in the application
  13. */
  14. public function main()
  15. {
  16. $this->registerModules(array(
  17. 'frontend' => array(
  18. 'className' => 'Multiple\Frontend\Module',
  19. 'path' => '../apps/frontend/Module.php'
  20. ),
  21. 'backend' => array(
  22. 'className' => 'Multiple\Backend\Module',
  23. 'path' => '../apps/backend/Module.php'
  24. )
  25. ));
  26. }
  27. }
  28. $application = new Application();
  29. $application->main();

Methods

public __construct ([unknown $dependencyInjector])

public Phalcon\Mvc\Application useImplicitView (unknown $implicitView)

By default. The view is implicitly buffering all the output You can full disable the view component using this method

public registerModules (unknown $modules, [unknown $merge])

Register an array of modules present in the application

  1. <?php
  2. $this->registerModules(array(
  3. 'frontend' => array(
  4. 'className' => 'Multiple\Frontend\Module',
  5. 'path' => '../apps/frontend/Module.php'
  6. ),
  7. 'backend' => array(
  8. 'className' => 'Multiple\Backend\Module',
  9. 'path' => '../apps/backend/Module.php'
  10. )
  11. ));

public array getModules ()

Return the modules registered in the application

public array|object getModule (unknown $name)

Gets the module definition registered in the application via module name

public Phalcon\Mvc\Application setDefaultModule (unknown $defaultModule)

Sets the module name to be used if the router doesn’t return a valid module

public string getDefaultModule ()

Returns the default module name

public Phalcon\Http\ResponseInterface |boolean handle ([unknown $uri])

Handles a MVC request

public setDI (unknown $dependencyInjector) inherited from Phalcon\Di\Injectable

Sets the dependency injector

public Phalcon\DiInterface getDI () inherited from Phalcon\Di\Injectable

Returns the internal dependency injector

public setEventsManager (unknown $eventsManager) inherited from Phalcon\Di\Injectable

Sets the event manager

public Phalcon\Events\ManagerInterface getEventsManager () inherited from Phalcon\Di\Injectable

Returns the internal event manager

public __get (unknown $propertyName) inherited from Phalcon\Di\Injectable

Magic method __get