From e8b60312037e54c34a06d6f57d7c21946cf3cd1f Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 28 Dec 2005 20:17:54 +0000 Subject: Modified the way to access application singleton. IService and IModule interfaces are also adjusted accordingly. --- framework/TComponent.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'framework/TComponent.php') diff --git a/framework/TComponent.php b/framework/TComponent.php index 0282be3a..432dba66 100644 --- a/framework/TComponent.php +++ b/framework/TComponent.php @@ -426,6 +426,54 @@ class TComponent throw new TInvalidOperationException('component_statements_invalid',get_class($this),$statements,$e->getMessage()); } } + + /** + * @return TApplication current application instance + */ + public function getApplication() + { + return Prado::getApplication(); + } + + /** + * @return IService the current service + */ + public function getService() + { + return Prado::getApplication()->getService(); + } + + /** + * @return THttpRequest the current user request + */ + public function getRequest() + { + return Prado::getApplication()->getRequest(); + } + + /** + * @return THttpResponse the response + */ + public function getResponse() + { + return Prado::getApplication()->getResponse(); + } + + /** + * @return THttpSession user session + */ + public function getSession() + { + return Prado::getApplication()->getSession(); + } + + /** + * @return IUser user + */ + public function getUser() + { + return Prado::getApplication()->getUser(); + } } /** -- cgit v1.2.3