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


PHP AbstractController::setModel方法代码示例

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


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

示例1: setModel

 /** Specify user model */
 function setModel($model, $login_field = 'email', $password_field = 'password')
 {
     parent::setModel($model);
     $this->login_field = $login_field;
     $this->password_field = $password_field;
     // Load model from session
     if ($this->info && $this->recall("id")) {
         if ($this->recall('class', false) == get_class($this->model)) {
             $this->debug("Loading model from cache");
             $this->model->set($this->info);
             $this->model->dirty = array();
             $this->model->id = $this->recall('id', null);
         } else {
             // Class changed, re-fetch data from database
             $this->debug("Class changed, loading from database");
             $this->model->tryLoad($this->recall('id'));
             if (!$this->model->loaded()) {
                 $this->logout(false);
             }
             $this->memorizeModel();
         }
     }
     $t = $this;
     // If model is saved, update our cache too, but don't store password
     $this->model->addHook('afterSave', function ($m) use($t) {
         // after this model is saved, re-cache the info
         $tmp = $m->get();
         unset($tmp[$t->password_field]);
         $t->memorize('info', $tmp);
     });
     $this->addEncryptionHook($this->model);
     if (strtolower($this->api->page) == 'logout') {
         $this->logout();
         $this->api->redirect('/');
     }
     return $this->model;
 }
开发者ID:xavocvijay,项目名称:atkschool,代码行数:38,代码来源:Basic.php

示例2: setModel

 /**
  * Allows use of models. Define a model with fields:
  *  - rule
  *  - target
  *  - params (comma separated)
  *
  * and content of that model will be used to auto-fill routing
  */
 function setModel($model)
 {
     $model = parent::setModel($model);
     foreach ($model as $rule) {
         $this->addRule($rule["rule"], $rule["target"], explode(",", $rule["params"]));
     }
     return $this;
 }
开发者ID:easyconn,项目名称:atk4,代码行数:16,代码来源:PatternRouter.php

示例3: setModel

 function setModel($m)
 {
     parent::setModel($m);
     $this->api->addHook('localizeString', $this);
     $this->api->translation = $this;
 }
开发者ID:xavocvijay,项目名称:atkschool,代码行数:6,代码来源:Basic.php

示例4: setModel

 function setModel($model, $login_field = 'email', $password_field = 'password')
 {
     parent::setModel($model);
     $this->login_field = $login_field;
     $this->password_field = $password_field;
     return $this->model;
 }
开发者ID:romaninsh,项目名称:Agile-Postfix-Admin,代码行数:7,代码来源:BasicAuth.php

示例5: setModel

 /**
  * Allows use of models. Define a model with fields:
  *  - rule
  *  - target
  *  - params (comma separated).
  *
  * and content of that model will be used to auto-fill routing
  */
 public function setModel($model)
 {
     /** @type Model $model */
     $model = parent::setModel($model);
     foreach ($model as $rule) {
         $this->addRule($rule['rule'], $rule['target'], explode(',', $rule['params']));
     }
     // @todo Consider to return $model instead of $this like we do in setModel method of all other classes
     return $this;
 }
开发者ID:atk4,项目名称:atk4,代码行数:18,代码来源:PatternRouter.php

示例6: setModel

 public function setModel($model)
 {
     $m = $this->add($model);
     //If model is empty, load data from files
     if (!$m->count()->getOne()) {
         $m = $this->fillFromFile($m);
     }
     parent::setModel($m);
 }
开发者ID:rvadym,项目名称:languages,代码行数:9,代码来源:AbstractLanguageSwitcher.php


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