Phalcon dispatcher
NOTE
All classes are prefixed with Phalcon
Dispatcher\AbstractDispatcher ¶
-
Namespace
Phalcon\Dispatcher
-
Uses
Exception
Phalcon\Di\AbstractInjectionAware
Phalcon\Di\DiInterface
Phalcon\Dispatcher\Exception
Phalcon\Events\EventsAwareInterface
Phalcon\Events\ManagerInterface
Phalcon\Filter\FilterInterface
Phalcon\Mvc\Model\Binder
Phalcon\Mvc\Model\BinderInterface
-
Extends
AbstractInjectionAware
-
Implements
DispatcherInterface
EventsAwareInterface
This is the base class for Phalcon\Mvc\Dispatcher and Phalcon\Cli\Dispatcher. This class can't be instantiated directly, you can use it to create your own dispatchers.
Properties¶
/**
* @var object|null
*/
protected $activeHandler;
/**
* @var array
*/
protected $activeMethodMap;
/**
* @var string
*/
protected $actionName = ;
/**
* @var string
*/
protected $actionSuffix = Action;
/**
* @var array
*/
protected $camelCaseMap;
/**
* @var string
*/
protected $defaultAction = ;
/**
* @var string
*/
protected $defaultNamespace = ;
/**
* @var string
*/
protected $defaultHandler = ;
/**
* @var array
*/
protected $handlerHashes;
/**
* @var string
*/
protected $handlerName = ;
/**
* @var string
*/
protected $handlerSuffix = ;
/**
* @var ManagerInterface|null
*/
protected $eventsManager;
/**
* @var bool
*/
protected $finished = false;
/**
* @var bool
*/
protected $forwarded = false;
/**
* @var bool
*/
protected $isControllerInitialize = false;
/**
* @var mixed|null
*/
protected $lastHandler;
/**
* @var BinderInterface|null
*/
protected $modelBinder;
/**
* @var bool
*/
protected $modelBinding = false;
/**
* @var string
*/
protected $moduleName = ;
/**
* @var string
*/
protected $namespaceName = ;
/**
* @var array
*/
protected $params;
/**
* @var string|null
*/
protected $previousActionName = ;
/**
* @var string|null
*/
protected $previousHandlerName = ;
/**
* @var string|null
*/
protected $previousNamespaceName = ;
/**
* @var string|null
*/
protected $returnedValue;
Methods¶
Process the results of the router by calling into the appropriate controller action(s) including any routing data or injected parameters. Forwards the execution flow to another controller/action.@throws PhalconException
Gets the latest dispatched action name Gets the default action suffix Returns the current method to be/executed in the dispatcher Returns bound models from binder instanceclass UserController extends Controller
{
public function showAction(User $user)
{
// return array with $user
$boundModels = $this->dispatcher->getBoundModels();
}
}
public function getParameter( mixed $param, mixed $filters = null, mixed $defaultValue = null ): mixed;
@todo remove this in future versions
Returns value returned by the latest dispatched action Check if a param exists @todo deprecate this in the future Check if a param exists Checks if the dispatch loop is finished or has more pendent controllers/tasks to dispatch Sets the action name to be dispatched Sets the default action suffix Sets the default action name Sets the default namespace Sets the events manager Sets the default suffix for the handlerpublic function setModelBinder( BinderInterface $modelBinder, mixed $cache = null ): DispatcherInterface;
$di->set(
'dispatcher',
function() {
$dispatcher = new Dispatcher();
$dispatcher->setModelBinder(
new Binder(),
'cache'
);
return $dispatcher;
}
);
Dispatcher\DispatcherInterface ¶
-
Namespace
Phalcon\Dispatcher
-
Uses
-
Extends
-
Implements
Interface for Phalcon\Dispatcher\AbstractDispatcher
Methods¶
Dispatches a handle action taking into account the routing parameters Forwards the execution flow to another controller/action Gets last dispatched action name Gets the default action suffix Gets the default handler suffix Gets a param by its name or numeric index Gets a param by its name or numeric index Gets action params Gets action params Returns value returned by the latest dispatched action Check if a param exists Checks if the dispatch loop is finished or has more pendent controllers/tasks to dispatch Sets the action name to be dispatched Sets the default action suffix Sets the default action name Sets the default namespace Sets the default suffix for the handler Sets the module name which the application belongs to Sets the namespace which the controller belongs to Set a param by its name or numeric index Sets action params to be dispatchedDispatcher\Exception¶
-
Namespace
Phalcon\Dispatcher
-
Uses
-
Extends
\Exception
-
Implements
Exceptions thrown in Phalcon\Dispatcher/* will use this class