Q_Dispatcher Class
This class lets you dispatch requests
Item Index
Methods
Properties
- $errorsOccurred static
- $handlingErrors static
- $routed static
- $servedResponse static
- $skip static
- $startedResponse static
- $uri static
- @startedDispatch static
Methods
dispatch
-
[$uri=null]
-
[$check=array('accessible')]
Dispatches a URI for internal processing. Usually called by a front controller.
Parameters:
-
[$uri=null]
Mixed optionalYou can pass a custom URI to dispatch. Otherwise, Qbix will attempt to route the requested URL, if any.
-
[$check=array('accessible')]
Array optionalPass array() to skip checking whether the URI can be obtained as a result of routing some URL.
Returns:
errors
-
$exception
-
$module
-
[$partialResponse=null]
Parameters:
-
$exception
Exception -
$module
String -
[$partialResponse=null]
String optional
forward
-
$uri
-
[$check=array('accessible')]
-
[$skip=null]
Forwards internally to a new URL, starting the dispatcher loop again
Parameters:
-
$uri
MixedThe URI to forward to, either as a string, an array or a Q_Uri object.
-
[$check=array('accessible')]
Mixed optionalPass array() here to skip checking whether the URI can be obtained as a result of routing some URL.
-
[$skip=null]
Array optionalPass an array of events to avoid firing the next time through the dispatcher loop.
forward
-
$uri
Forwards internally to the URI "$AppName/notFound", starting the dispatcher loop again
Parameters:
-
$uri
MixedThe URI to forward to, either as a string, an array or a Q_Uri object.
response
-
[$closeConnection=false]
-
[$flushBuffers=false]
Returns a response to the client.
Parameters:
-
[$closeConnection=false]
Boolean optionalWhether to flush all the buffers and send headers to close the connection
-
[$flushBuffers=false]
Boolean optionalWhether to flush the buffers
result
-
[$new_result=null]
-
[$overwrite=false]
Used to get/set the result of the dispatching
Parameters:
-
[$new_result=null]
String optionalPass a string here to record a result of the dispatching.
-
[$overwrite=false]
Boolean optionalIf a result is already set, doesn't override it unless you pass true here.
showErrors
()
static
Stops processing the request and asks the dispatcher to jump straight to displaying the errors.
skip
()
static
Call this to tell the dispatcher to skip firing a certain event coming up
Properties
$errorsOccurred
Boolean
protected
static
$handlingErrors
Boolean
protected
static
$routed
Array
public
static
$servedResponse
Boolean
public
static
Whether a response was served since the last time dispatch started
$skip
Array
protected
static
$startedResponse
Boolean
public
static
Whether a response was started, since the beginning of the request
@startedDispatch
Boolean
public
static
Whether the dispatch method was called since the beginning of the request
Events
$module/errors
Event Payload:
-
exception
Exception -
module
String -
partialResponse
String
Q/analytics
Gives the app a chance to gather analytics from the request.
Event Payload:
-
$routed
Array
Q/dir
Event Payload:
-
filename
String -
routed_uri
String
Q/errors
Event Payload:
-
exception
Exception -
module
String -
partialResponse
String
Q/exception
Event Payload:
-
exception
Exception
Q/file
Event Payload:
-
filename
String -
routed_uri
String
Q/noModule
Occurs when no module was found during routing. The parameters are the routed array
Q/notFound
Occurs when no defined action was found during routing. The parameters are the routed array
Event Payload:
-
$routed
Array
Q/objects
Gives the app a chance to fetch objects needed for handling the request.
Event Payload:
-
$routed
Array
Q/prepare
Gives the app a chance to prepare for handling a request The parameters are the routed array
Event Payload:
-
$routed
Array
Q/reroute
Gives the app a chance to reroute the request
Event Payload:
-
$routed
Array
Q/response
Gives the app a chance to generate a response. You should not change the server state when handling this event.
Event Payload:
-
$routed
Array
Q/validate
Gives the app a chance to validate the request and call Q_Response::addError() zero or more times. The parameters are the routed array
Event Payload:
-
$routed
Array