PHP 클래스 Zend\Mvc\Application
Expects the user will provide a configured ServiceManager, configured with
the following services:
- EventManager
- ModuleManager
- Request
- Response
- RouteListener
- Router
- DispatchListener
- ViewManager
The most common workflow is:
$services = new Zend\ServiceManager\ServiceManager($servicesConfig);
$app = new Application($appConfig, $services);
$app->bootstrap();
$response = $app->run();
$response->send();
bootstrap() opts in to the default route, dispatch, and view listeners,
sets up the MvcEvent, and triggers the bootstrap event. This can be omitted
if you wish to setup your own listeners and/or workflow; alternately, you
can simply extend the class to override such behavior.
파일 보기
프로젝트 열기: zendframework/zend-mvc
1 사용 예제들
보호된 프로퍼티들
공개 메소드들
메소드 |
설명 |
|
__construct ( Zend\ServiceManager\ServiceManager $serviceManager, Zend\EventManager\EventManagerInterface $events = null, Zend\Stdlib\RequestInterface $request = null, Zend\Stdlib\ResponseInterface $response = null ) |
Constructor |
|
bootstrap ( array $listeners = [] ) : Application |
Bootstrap the application |
|
getConfig ( ) : array | object |
Retrieve the application configuration |
|
getEventManager ( ) : Zend\EventManager\EventManagerInterface |
Retrieve the event manager |
|
getMvcEvent ( ) : MvcEvent |
Get the MVC event instance |
|
getRequest ( ) : Zend\Stdlib\RequestInterface |
Get the request object |
|
getResponse ( ) : Zend\Stdlib\ResponseInterface |
Get the response object |
|
getServiceManager ( ) : Zend\ServiceManager\ServiceManager |
Retrieve the service manager |
|
init ( array $configuration = [] ) : Application |
Static method for quick and easy initialization of the Application. |
|
run ( ) : self |
Run the application |
|
setEventManager ( Zend\EventManager\EventManagerInterface $eventManager ) : Application |
Set the event manager instance |
|
보호된 메소드들
메소드 |
설명 |
|
completeRequest ( MvcEvent $event ) : Application |
Complete the request |
|
메소드 상세
public __construct ( Zend\ServiceManager\ServiceManager $serviceManager, Zend\EventManager\EventManagerInterface $events = null, Zend\Stdlib\RequestInterface $request = null, Zend\Stdlib\ResponseInterface $response = null ) |
$serviceManager |
Zend\ServiceManager\ServiceManager |
|
$events |
Zend\EventManager\EventManagerInterface |
|
$request |
Zend\Stdlib\RequestInterface |
|
$response |
Zend\Stdlib\ResponseInterface |
|
Defines and binds the MvcEvent, and passes it the request, response, and
router. Attaches the ViewManager as a listener. Triggers the bootstrap
event.
public bootstrap ( array $listeners = [] ) : Application |
$listeners |
array |
List of listeners to attach. |
리턴 |
Application |
|
completeRequest()
보호된 메소드
Triggers "render" and "finish" events, and returns response from
event object.
protected completeRequest ( MvcEvent $event ) : Application |
$event |
MvcEvent |
|
리턴 |
Application |
|
Retrieve the application configuration
Lazy-loads an EventManager instance if none registered.
public getEventManager ( ) : Zend\EventManager\EventManagerInterface |
리턴 |
Zend\EventManager\EventManagerInterface |
|
Get the MVC event instance
public getRequest ( ) : Zend\Stdlib\RequestInterface |
리턴 |
Zend\Stdlib\RequestInterface |
|
public getResponse ( ) : Zend\Stdlib\ResponseInterface |
리턴 |
Zend\Stdlib\ResponseInterface |
|
getServiceManager()
공개 메소드
Retrieve the service manager
public getServiceManager ( ) : Zend\ServiceManager\ServiceManager |
리턴 |
Zend\ServiceManager\ServiceManager |
|
If you use this init() method, you cannot specify a service with the
name of 'ApplicationConfig' in your service manager config. This name is
reserved to hold the array from application.config.php.
The following services can only be overridden from application.config.php:
- ModuleManager
- SharedEventManager
- EventManager & Zend\EventManager\EventManagerInterface
All other services are configured after module loading, thus can be
overridden by modules.
public static init ( array $configuration = [] ) : Application |
$configuration |
array |
|
리턴 |
Application |
|
public run ( ) : self |
리턴 |
self |
|
Set the event manager instance
public setEventManager ( Zend\EventManager\EventManagerInterface $eventManager ) : Application |
$eventManager |
Zend\EventManager\EventManagerInterface |
|
리턴 |
Application |
|
프로퍼티 상세
$defaultListeners 보호되어 있는 프로퍼티
Default application event listeners
protected array $defaultListeners |
리턴 |
array |
|
protected MvcEvent,Zend\Mvc $event |
리턴 |
MvcEvent |
|
protected EventManagerInterface,Zend\EventManager $events |
리턴 |
Zend\EventManager\EventManagerInterface |
|
protected RequestInterface,Zend\Stdlib $request |
리턴 |
Zend\Stdlib\RequestInterface |
|
protected ResponseInterface,Zend\Stdlib $response |
리턴 |
Zend\Stdlib\ResponseInterface |
|
$serviceManager 보호되어 있는 프로퍼티
protected ServiceManager,Zend\ServiceManager $serviceManager |
리턴 |
Zend\ServiceManager\ServiceManager |
|