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.
상속: implements Zend\Mvc\ApplicationInterface, implements Zend\EventManager\EventManagerAwareInterface
파일 보기 프로젝트 열기: zendframework/zend-mvc 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$defaultListeners array Default application event listeners
$event MvcEvent MVC event token
$events Zend\EventManager\EventManagerInterface
$request Zend\Stdlib\RequestInterface
$response Zend\Stdlib\ResponseInterface
$serviceManager Zend\ServiceManager\ServiceManager

공개 메소드들

메소드 설명
__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

메소드 상세

__construct() 공개 메소드

Constructor
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

bootstrap() 공개 메소드

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

getConfig() 공개 메소드

Retrieve the application configuration
public getConfig ( ) : array | object
리턴 array | object

getEventManager() 공개 메소드

Lazy-loads an EventManager instance if none registered.
public getEventManager ( ) : Zend\EventManager\EventManagerInterface
리턴 Zend\EventManager\EventManagerInterface

getMvcEvent() 공개 메소드

Get the MVC event instance
public getMvcEvent ( ) : MvcEvent
리턴 MvcEvent

getRequest() 공개 메소드

Get the request object
public getRequest ( ) : Zend\Stdlib\RequestInterface
리턴 Zend\Stdlib\RequestInterface

getResponse() 공개 메소드

Get the response object
public getResponse ( ) : Zend\Stdlib\ResponseInterface
리턴 Zend\Stdlib\ResponseInterface

getServiceManager() 공개 메소드

Retrieve the service manager
public getServiceManager ( ) : Zend\ServiceManager\ServiceManager
리턴 Zend\ServiceManager\ServiceManager

init() 공개 정적인 메소드

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

run() 공개 메소드

Run the application
public run ( ) : self
리턴 self

setEventManager() 공개 메소드

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

$event 보호되어 있는 프로퍼티

MVC event token
protected MvcEvent,Zend\Mvc $event
리턴 MvcEvent

$events 보호되어 있는 프로퍼티

protected EventManagerInterface,Zend\EventManager $events
리턴 Zend\EventManager\EventManagerInterface

$request 보호되어 있는 프로퍼티

protected RequestInterface,Zend\Stdlib $request
리턴 Zend\Stdlib\RequestInterface

$response 보호되어 있는 프로퍼티

protected ResponseInterface,Zend\Stdlib $response
리턴 Zend\Stdlib\ResponseInterface

$serviceManager 보호되어 있는 프로퍼티

protected ServiceManager,Zend\ServiceManager $serviceManager
리턴 Zend\ServiceManager\ServiceManager