本文整理汇总了PHP中CController::createAction方法的典型用法代码示例。如果您正苦于以下问题:PHP CController::createAction方法的具体用法?PHP CController::createAction怎么用?PHP CController::createAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CController
的用法示例。
在下文中一共展示了CController::createAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createAction
public function createAction($actionID)
{
$action = parent::createAction($actionID);
if ($action !== null) {
return $action;
}
foreach ($this->_behaviorIDs as $behaviorID) {
$object = $this->asa($behaviorID);
if ($object->getEnabled() && method_exists($object, 'action' . $actionID)) {
return new CInlineAction($object, $actionID);
}
}
}
示例2: createAction
/**
* This overrides the default behaviour for supported resources by pushing the resource
* into the GET parameter and updating the actionID.
*
* This is necessary because there's no way of pushing the appropriate pattern to the top of the
* URLManager config, so this captures calls where the id doesn't contain non-numerics.
*
* @param string $actionID
*
* @return \CAction|\CInlineAction
*/
public function createAction($actionID)
{
if (in_array($actionID, static::$resources)) {
$_GET['resource_type'] = $actionID;
switch (\Yii::app()->getRequest()->getRequestType()) {
case 'PUT':
return parent::createAction('Update');
break;
case 'DELETE':
return parent::createAction('Delete');
break;
default:
$this->sendResponse(405);
break;
}
}
return parent::createAction($actionID);
}
示例3: createActionInstances
/**
* Creates the action instances for the given controller
* @param \CController $controller the controller to get actions for
*
* @return \CAction[] the controller actions
*/
protected function createActionInstances(\CController $controller)
{
$actions = array();
foreach ($controller->actions() as $id => $config) {
$actions[$id] = $controller->createAction($id);
}
$reflector = new \ReflectionObject($controller);
foreach ($reflector->getMethods() as $name => $method) {
if ($name != 'actions' && substr($name, 0, 6) == 'action') {
$id = lcfirst(substr($name, 6));
$actions[$id] = $controller->createAction($id);
}
}
return $actions;
}
示例4: createAction
/**
* Creates the action instance based on the action name.
* Additionally, this implementing checks attached behaviors for actions.
*/
public function createAction($actionID)
{
$action = parent::createAction($actionID);
// search in behaviors
if ($action === null) {
foreach ($this->behaviors() as $behavior => $data) {
$behavior = $this->{$behavior};
if (is_subclass_of($behavior, 'IBehavior') && method_exists($behavior, 'action' . $actionID)) {
return new CInlineAction($behavior, $actionID);
}
}
}
return $action;
}