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


PHP ClassRegistry::load方法代码示例

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


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

示例1: dispatch

 private function dispatch()
 {
     if ($this->arguments["command"] == "") {
         $this->error("can't call empty command");
     }
     $fileName = "{$this->arguments['script']}_{$this->arguments['command']}";
     $className = Inflector::camelize($fileName);
     if ($command =& ClassRegistry::load($className, "Command")) {
         if (can_call_method($command, "execute")) {
             call_user_func_array(array($command, "execute"), $this->arguments["params"]);
         } else {
             $this->error("can't execute command {$className}");
         }
     } else {
         $this->error("command {$className} not found");
     }
 }
开发者ID:simaopedros,项目名称:spaghettiphp,代码行数:17,代码来源:shell.php

示例2: dispatch

 /**
  *  Chama o controller e a action solicitadas pela URL.
  * 
  *  @return mixed Instância do novo controller ou falso em caso de erro
  */
 public function dispatch()
 {
     $path = Mapper::parse();
     $path["controller"] = Inflector::hyphenToUnderscore($path["controller"]);
     $path["action"] = Inflector::hyphenToUnderscore($path["action"]);
     $controller_name = Inflector::camelize($path["controller"]) . "Controller";
     if ($controller =& ClassRegistry::load($controller_name, "Controller")) {
         if (!can_call_method($controller, $path['action']) && !App::path("View", "{$path['controller']}/{$path['action']}.{$path['extension']}")) {
             $this->error("missingAction", array("controller" => $path["controller"], "action" => $path["action"]));
             return false;
         }
     } else {
         if (App::path("View", "{$path['controller']}/{$path['action']}.{$path['extension']}")) {
             $controller =& ClassRegistry::load("AppController", "Controller");
         } else {
             $this->error("missingController", array("controller" => $path["controller"]));
             return false;
         }
     }
     $controller->params = $path;
     $controller->componentEvent("initialize");
     $controller->beforeFilter();
     $controller->componentEvent("startup");
     if (in_array($path["action"], $controller->methods) && can_call_method($controller, $path["action"])) {
         $params = $path["params"];
         if (!is_null($path["id"])) {
             $params = array_merge(array($path["id"]), $params);
         }
         call_user_func_array(array(&$controller, $path["action"]), $params);
     }
     if ($controller->autoRender) {
         $controller->render();
     }
     $controller->componentEvent("shutdown");
     echo $controller->output;
     $controller->afterFilter();
     return $controller;
 }
开发者ID:vfeitoza,项目名称:spaghettiphp,代码行数:43,代码来源:dispatcher.php

示例3: identify

 /**
  *  Identifica o usuário no banco de dados.
  *
  *  @param array $conditions Condições da busca
  *  @return array Dados do usuário
  */
 public function identify($conditions)
 {
     $userModel = ClassRegistry::load($this->userModel);
     if (!$userModel) {
         $this->error("missingModel", array("model" => $this->userModel));
         return false;
     }
     $params = array("conditions" => array_merge($this->userScope, $conditions), "recursion" => is_null($this->recursion) ? $userModel->recursion : $this->recursion);
     return $this->user = $userModel->first($params);
 }
开发者ID:vfeitoza,项目名称:spaghettiphp,代码行数:16,代码来源:auth_component.php

示例4: loadModel

 /**
  *  Carrega um modelo.
  *
  *  @param string $model Nome do modelo a ser carregado
  *  @return boolean Verdadeiro se o modelo foi carregado
  */
 public function loadModel($model)
 {
     if (!isset($this->{$model})) {
         if ($class =& ClassRegistry::load($model)) {
             $this->{$model} = $class;
         } else {
             $this->error("missingModel", array("model" => $model));
             return false;
         }
     }
     return true;
 }
开发者ID:vfeitoza,项目名称:spaghettiphp,代码行数:18,代码来源:model.php

示例5: loadModels

 /**
  *  Carrega todos os models associados ao controller.
  *
  *  @return boolean
  */
 public function loadModels()
 {
     foreach ($this->uses as $model) {
         if (!($this->{$model} = ClassRegistry::load($model))) {
             $this->error("missingModel", array("model" => $model));
             return false;
         }
     }
     return true;
 }
开发者ID:simaopedros,项目名称:spaghettiphp,代码行数:15,代码来源:controller.php

示例6: model

 /**
  *  Carrega o Model a ser utilizado na paginação.
  *
  *  @param string $model Model utilizado
  *  @return object
  */
 public function model($model)
 {
     return $this->model = ClassRegistry::load($model);
 }
开发者ID:vfeitoza,项目名称:spaghettiphp,代码行数:10,代码来源:pagination_helper.php


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