TApplication class.
TApplication coordinates modules and services, and serves as a configuration context for all Prado components.
TApplication uses a configuration file to specify the settings of the application, the modules, the services, the parameters, and so on.
TApplication adopts a modular structure. A TApplication instance is a composition of multiple modules. A module is an instance of class implementing IModule interface. Each module accomplishes certain functionalities that are shared by all Prado components in an application. There are default modules and user-defined modules. The latter offers extreme flexibility of extending TApplication in a plug-and-play fashion. Modules cooperate with each other to serve a user request by following a sequence of lifecycles predefined in TApplication.
TApplication has four modes that can be changed by setting Mode property (in the application configuration file).
TApplication maintains a lifecycle with the following stages:
Examples:
- $application=new TApplication($configFile);
- $application->run();
Located in /TApplication.php (line 112)
TComponent | --TApplication
Class | Description |
---|---|
TShellApplication | TShellApplication class. |
Applies an application configuration.
Clears a global value.
The value cleared will no longer be available in this request and the following requests.
Completes current request processing.
This method can be used to exit the application lifecycles after finishing the current cycle.
Constructor.
Sets application base path and initializes the application singleton. Application base path refers to the root directory storing application data and code not directly accessible by Web users. By default, the base path is assumed to be the protected directory under the directory containing the current running script.
Flushes output to client side.
Returns a global value.
A global value is one that is persistent across users sessions and requests.
Returns the list of application parameters.
Since the parameters are returned as a TMap object, you may use the returned result to access, add or remove individual parameters.
Loads configuration and initializes application.
Configuration file will be read and parsed (if a valid cached version exists, it will be used instead). Then, modules are created and initialized; Afterwards, the requested service is created and initialized.
Loads global values from persistent storage.
This method is invoked when OnLoadState event is raised. After this method, values that are stored in previous requests become available to the current request via getGlobalState.
Raises OnAuthentication event.
This method is invoked when the user request needs to be authenticated.
Raises OnAuthenticationComplete event.
This method is invoked right after the user request is authenticated.
Raises OnAuthorization event.
This method is invoked when the user request needs to be authorized.
Raises OnAuthorizationComplete event.
This method is invoked right after the user request is authorized.
Raises OnBeginRequest event.
At the time when this method is invoked, application modules are loaded and initialized, user request is resolved and the corresponding service is loaded and initialized. The application is about to start processing the user request.
Raises OnEndRequest event.
This method is invoked when the application completes the processing of the request.
Raises OnError event.
This method is invoked when an exception is raised during the lifecycles of the application.
Raises OnLoadState event.
This method is invoked when the application needs to load state (probably stored in session).
Raises OnLoadStateComplete event.
This method is invoked right after the application state has been loaded.
Raises OnPreFlushOutput event.
This method is invoked right before the application flushes output to client.
Raises OnPreRunService event.
This method is invoked right before the service is to be run.
Raises OnSaveState event.
This method is invoked when the application needs to save state (probably stored in session).
Raises OnSaveStateComplete event.
This method is invoked right after the application state has been saved.
Resolves application-relevant paths.
This method is invoked by the application constructor to determine the application configuration file, application root path and the runtime path.
Executes the lifecycles of the application.
This is the main entry function that leads to the running of the whole Prado application.
Runs the requested service.
Saves global values into persistent storage.
This method is invoked when OnSaveState event is raised.
Sets a global value.
A global value is one that is persistent across users sessions and requests. Make sure that the value is serializable and unserializable.
Adds a module to application.
Note, this method does not do module initialization.
Starts the specified service.
The service instance will be created. Its properties will be initialized and the configurations will be applied, if any.
Inherited From TComponent
TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__get()
TComponent::__set()
Config cache file
Application configuration file name
File extension for external config files
Global data file
Page service ID
Runtime directory name
possible application mode.
Documentation generated on Mon, 21 Apr 2008 11:30:20 -0400 by phpDocumentor 1.3.0RC4