当前位置: 首页>>代码示例>>PHP>>正文


PHP Inflector::id2camel方法代码示例

本文整理汇总了PHP中yii\helpers\Inflector::id2camel方法的典型用法代码示例。如果您正苦于以下问题:PHP Inflector::id2camel方法的具体用法?PHP Inflector::id2camel怎么用?PHP Inflector::id2camel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\helpers\Inflector的用法示例。


在下文中一共展示了Inflector::id2camel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 public function render()
 {
     $activeWindowHash = Yii::$app->request->get('activeWindowHash');
     $activeWindowCallback = Yii::$app->request->get('activeWindowCallback');
     $activeWindows = $this->config->getPointer('aw');
     $obj = $activeWindows[$activeWindowHash]['object'];
     $function = 'callback' . Inflector::id2camel($activeWindowCallback);
     return ObjectHelper::callMethodSanitizeArguments($obj, $function, Yii::$app->request->post());
     /*
     $reflection = new \ReflectionMethod($obj, $function);
     
     $methodArgs = [];
     
     if ($reflection->getNumberOfRequiredParameters() > 0) {
         foreach ($reflection->getParameters() as $param) {
             if (!array_key_exists($param->name, $args)) {
                 throw new \Exception("the provided argument '".$param->name."' does not exists in the provided arguments list.");
             }
             $methodArgs[] = $args[$param->name];
         }
     }
     
     $response = call_user_func_array(array($obj, $function), $methodArgs);
     
     return $response;
     */
 }
开发者ID:rocksolid-tn,项目名称:luya,代码行数:27,代码来源:RenderActiveWindowCallback.php

示例2: testId2camel

 public function testId2camel()
 {
     $this->assertEquals('PostTag', Inflector::id2camel('post-tag'));
     $this->assertEquals('PostTag', Inflector::id2camel('post_tag', '_'));
     $this->assertEquals('PostTag', Inflector::id2camel('post-tag'));
     $this->assertEquals('PostTag', Inflector::id2camel('post_tag', '_'));
 }
开发者ID:rajanishtimes,项目名称:basicyii,代码行数:7,代码来源:InflectorTest.php

示例3: getView

 public function getView()
 {
     if ($this->_view === null) {
         $this->_view = lcfirst(Inflector::id2camel($this->id));
     }
     return $this->_view;
 }
开发者ID:hiqdev,项目名称:hipanel-core,代码行数:7,代码来源:IndexAction.php

示例4: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->action === null) {
         $this->action = Inflector::id2camel($this->id);
     }
 }
开发者ID:sangkil,项目名称:application,代码行数:10,代码来源:CustomCreateAction.php

示例5: actionIndex

 public function actionIndex($callback, $id)
 {
     $model = NavItemPageBlockItem::findOne($id);
     $block = Block::objectId($model->block_id, $model->id, 'callback');
     $method = 'callback' . Inflector::id2camel($callback);
     return ObjectHelper::callMethodSanitizeArguments($block, $method, Yii::$app->request->get());
 }
开发者ID:gitter-badger,项目名称:luya,代码行数:7,代码来源:BlockController.php

示例6: search

 /**
  * Sends a request to the _search API and returns the result.
  * @param array $options
  * @throws ErrorResponseException
  * @return mixed
  */
 public function search($options = [])
 {
     $url = $this->index . Inflector::id2camel(ArrayHelper::remove($options, 'scenario', 'search'));
     $query = $this->queryParts;
     $options = array_merge($query, $options);
     return $this->db->post($url, $options);
 }
开发者ID:bscheshirwork,项目名称:yii2-hiart,代码行数:13,代码来源:Command.php

示例7: getModuleController

 /**
  * @param \yii\base\Module $module
  * @param string           $id
  *
  * @return \yii\base\Controller $controller
  */
 public function getModuleController(Module $module, $id)
 {
     $className = sprintf('%s\\%sController', $module->controllerNamespace, Inflector::id2camel($id));
     if (strpos($className, '-') === false && class_exists($className) && is_subclass_of($className, 'yii\\base\\Controller')) {
         return new $className($id, $module);
     }
     return null;
 }
开发者ID:voodoo-mobile,项目名称:yii2-core,代码行数:14,代码来源:Metadata.php

示例8: operationName

 /**
  * Returns name of the operation based on controller's class and it's action name
  * @param Controller|string $controller
  * @param string $action
  * @return string
  */
 public static function operationName($controller, $action = '')
 {
     if (is_object($controller)) {
         $controller = $controller->className();
     }
     /** @var string $controller */
     return self::authItemName($controller . ':' . Inflector::id2camel($action));
 }
开发者ID:omnilight,项目名称:yz2-admin,代码行数:14,代码来源:Rbac.php

示例9: hasAction

 public function hasAction($id, $actions = null)
 {
     if (is_null($actions)) {
         $actions = $this->actions();
     }
     $method = 'action' . Inflector::id2camel($id);
     return isset($actions[$id]) || method_exists($this, $method);
 }
开发者ID:hiqdev,项目名称:hipanel-core,代码行数:8,代码来源:CrudController.php

示例10: init

 public function init()
 {
     $modelId = Yii::$app->getRequest()->getQueryParam('modelId');
     if ($modelId) {
         $this->modelName = Inflector::id2camel($modelId);
     }
     parent::init();
 }
开发者ID:ivan-chkv,项目名称:yii2-mozayka,代码行数:8,代码来源:CrudController.php

示例11: getModelByTableName

 public function getModelByTableName($name)
 {
     $returnName = str_replace($this->tablePrefix, '', $name);
     $returnName = Inflector::id2camel($returnName, '_');
     if ($this->singularEntities) {
         $returnName = Inflector::singularize($returnName);
     }
     return $returnName;
 }
开发者ID:ICHydro,项目名称:anaconda,代码行数:9,代码来源:ModelTrait.php

示例12: testId2camel

 public function testId2camel()
 {
     $this->assertEquals('PostTag', Inflector::id2camel('post-tag'));
     $this->assertEquals('PostTag', Inflector::id2camel('post_tag', '_'));
     $this->assertEquals('PostTag', Inflector::id2camel('post-tag'));
     $this->assertEquals('PostTag', Inflector::id2camel('post_tag', '_'));
     $this->assertEquals('FooYBar', Inflector::id2camel('foo-y-bar'));
     $this->assertEquals('FooYBar', Inflector::id2camel('foo_y_bar', '_'));
 }
开发者ID:howq,项目名称:yii2,代码行数:9,代码来源:InflectorTest.php

示例13: __call

 /**
  * Calls the named method which is not a class method.
  * Call this method directly from database connections
  */
 public function __call($name, $params)
 {
     $method = explode('-', Inflector::camel2id($name));
     $model = array_shift($method);
     $method = lcfirst(Inflector::id2camel(implode('-', $method)));
     $class = isset($this->models[$model]) ? $this->models[$model] : null;
     if ($class && method_exists($class, $method)) {
         return call_user_func_array([$class, $method], $params);
     }
     $message = 'Calling unknown method: ' . ($class ? $class : get_class($this)) . "::{$name}()";
     throw new UnknownMethodException($message);
 }
开发者ID:phantom-d,项目名称:yii2-file-daemon,代码行数:16,代码来源:Connection.php

示例14: getAllChild

function getAllChild($role_id, $parent_id = NULL, $level = 0)
{
    foreach (\app\models\Menu::find()->where(["parent_id" => $parent_id])->all() as $menu) {
        ?>
                    <div class="form-group" style="padding-left: <?php 
        echo $level * 20;
        ?>
px">
                        <label>
                            <input type="checkbox" name="menu[]" value="<?php 
        echo $menu->id;
        ?>
" class="minimal" <?php 
        echo isChecked($role_id, $menu->id) ? "checked" : "";
        ?>
>
                        </label>
                        <label style="padding-left: 10px"> <?php 
        echo $menu->name;
        ?>
</label>
                    </div>
                <?php 
        //Show All Actions
        $camelName = Inflector::id2camel($menu->controller);
        $fullControllerName = "app\\controllers\\" . $camelName . "Controller";
        if (class_exists($fullControllerName)) {
            $reflection = new ReflectionClass($fullControllerName);
            $methods = $reflection->getMethods();
            echo "<div class=\"form-group\" style=\"padding-left: " . ($level * 20 + 10) . "px;\">";
            echo "<label><input type=\"checkbox\" class=\"minimal select-all\" ></label><label style=\"padding: 0px 20px 0px 5px\"> Select All</label>";
            foreach ($methods as $method) {
                if (substr($method->name, 0, 6) == "action" && $method->name != "actions") {
                    $camelAction = substr($method->name, 6);
                    $id = Inflector::camel2id($camelAction);
                    $name = Inflector::camel2words($camelAction);
                    $action = \app\models\Action::find()->where(["action_id" => $id, "controller_id" => $menu->controller])->one();
                    if ($action == NULL) {
                        //If the action not in database, save it !
                        $action = new \app\models\Action();
                        $action->action_id = $id;
                        $action->controller_id = $menu->controller;
                        $action->name = $name;
                        $action->save();
                    }
                    showCheckbox("action[]", $action->id, $name, hasAccessToAction($role_id, $action->id));
                }
            }
            echo "</div>";
        }
        getAllChild($role_id, $menu->id, $level + 1);
    }
}
开发者ID:febfeb,项目名称:yii2-basic-ready,代码行数:53,代码来源:detail.php

示例15: actionIndex

 public function actionIndex($callback, $id)
 {
     $model = NavItemPageBlockItem::findOne($id);
     if (!$model) {
         throw new Exception("Unable to find item id.");
     }
     $block = Block::objectId($model->block_id, $model->id, 'callback');
     if (!$block) {
         throw new Exception("Unable to find block object.");
     }
     return ObjectHelper::callMethodSanitizeArguments($block, 'callback' . Inflector::id2camel($callback), Yii::$app->request->get());
 }
开发者ID:luyadev,项目名称:luya-module-cms,代码行数:12,代码来源:BlockController.php


注:本文中的yii\helpers\Inflector::id2camel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。