ZMObject
└─ZMUrlManager
public class ZMUrlManager
extends ZMObject
| Fields inherited from org.zenmagick.core.ZMObject | |
|---|---|
| properties_ | |
| Constructor Summary | |
|---|---|
Create new instance. |
|
| Method Summary | |
|---|---|
| void | clear() Clear all mappings. |
| ZMController | findController(string requestId) Find and instantiate a controller object for the given request id. |
| array | findMapping(string requestId, string viewId, mixed parameter) Find a mapping for the given requestId (and viewId). |
| ZMView | findView(string requestId, string viewId, mixed parameter) Find and instantiate a view object for the given request id (and view id). |
| static void | instance() Get instance. |
| void | load(string yaml, boolean override) Load mappings from a YAML style string. |
| void | setMapping(string requestId, mixed mapping, boolean override) Set mapping details for a given request id. |
| Methods inherited from org.zenmagick.core.ZMObject | |
|---|---|
| attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton | |
public ZMUrlManager()
Create new instance.
public void clear()
Clear all mappings.
public ZMController findController(string requestId)
Find and instantiate a controller object for the given request id.
Determining the controller class is a three stage process:
public array findMapping(string requestId, string viewId, mixed parameter)
Find a mapping for the given requestId (and viewId).
This method will use a number of fallback/default conventions for missing mappings:
If no mapping is found for the given requestId, the global mappings will be queried.
Should that fail as well, null will be returned.
If mappings are found, the most specific values are returned. Mapping keys that do not exit will be
populated with a value of null.
null to use defaults.null.public ZMView findView(string requestId, string viewId, mixed parameter)
Find and instantiate a view object for the given request id (and view id).
If no mapping is found, some sensible defaults will be used.
The default view (definition) will is taken from the setting 'zenmagick.mvc.view.default'.
null to use defaults.null.public static void instance()
Get instance.
public void load(string yaml, boolean override)
Load mappings from a YAML style string.
true to override.public void setMapping(string requestId, mixed mapping, boolean override)
Set mapping details for a given request id.
true to override.
Central storage of url mappings.
URL mappings map things like the controller, view and template used to a requestId.
To simplify, there are a lot of conventions and defaults to minimize the need for using mappings.
Mappings may be set explicitely via the
setMapping()method. However, the preferred way is to load mappings from a configuration (YAML) file.