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


PHP AppModel::Create方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     // Data
     $this->data = $_POST;
     // TODO clean up data for SQL here?
     // View
     $this->View = new AppView();
     // Model
     if ($this->has_model) {
         // load Model class
         if (Globe::Load(Url::$data['model'], 'model')) {
             $this->Model = $this->{Url::$data['modelName']} = AppModel::Create(Url::$data['modelName']);
             // reference for ease
         }
     }
 }
开发者ID:nemoDreamer,项目名称:endo,代码行数:16,代码来源:controller.endo.php

示例2: signup

 public function signup()
 {
     if ($this->data) {
         if (!$this->data('email') || !$this->data('password')) {
             Error::Set("Fields blank!", 'validation');
             return false;
         }
         // create
         $this->Model = AppModel::Create(CLASS_USER_MEMBER, $this->data);
         // valid?
         if ($this->Model->save()) {
             $this->redirect('/users/login');
         }
     } else {
         $this->assign(array('redirect_to' => null, 'email' => null));
     }
 }
开发者ID:nemoDreamer,项目名称:endo,代码行数:17,代码来源:controller.users.php

示例3: Init

 static function Init($name, $type = 'class', $show_errors = true)
 {
     if (self::Load($name, $type, $show_errors)) {
         $class_name = AppInflector::classify($name, $type);
         return $type == 'model' ? AppModel::Create($class_name) : new $class_name();
     } else {
         return new stdClass();
     }
 }
开发者ID:nemoDreamer,项目名称:endo,代码行数:9,代码来源:class.globe.php

示例4: GetCurrent

 /**
  * This is basically the 'Login' function.
  * It cycles through different possible locations for the user,
  * lastly checking if a login is occurring.
  *
  * @return User object. FALSE on fail.
  */
 static function GetCurrent()
 {
     // session?
     if ($session = AppUser::GetSession()) {
         if ($user = AppUser::FetchFromString($session)) {
             return $user;
         }
     } elseif ($cookie = AppUser::GetCookie()) {
         if ($user = AppUser::FetchFromString($cookie)) {
             return $user;
         }
     } elseif (Url::GetRequest('check_data', false) && ($email = Url::GetRequest('email', false)) && ($password = Url::GetRequest('password', false))) {
         // valid?
         if (($user = AppUser::FetchUser($email)) && $user->validate($password)) {
             return AppUser::SetCurrent($user);
         } else {
             Error::Set("Invalid Email and/or Password", 'validation');
         }
     }
     // create Guest...
     return AppModel::Create(AppUser::$levels[0]);
 }
开发者ID:nemoDreamer,项目名称:endo,代码行数:29,代码来源:model.user.php

示例5: FindAllAssoc

 static function FindAllAssoc($strClass, $extend = FALSE, $mxdWhere = NULL, $strIndexBy = 'id', $strOrderBy = null, $intLimit = 10000, $intOffset = 0)
 {
     if (!AppModel::_smartLoadModel($strClass)) {
         return false;
     }
     $model = AppModel::Create($strClass);
     // TODO replace by ::singleton
     $strOrderBy = get_default($strOrderBy, $model->order_by);
     // get collection
     $collection = AppModel::FindAll($strClass, $extend, $mxdWhere, $strOrderBy, $intLimit, $intOffset);
     // associate label
     $output = array();
     foreach ($collection as $key => $object) {
         $output[$object->{$strIndexBy}] = $object;
     }
     return $output;
 }
开发者ID:nemoDreamer,项目名称:endo,代码行数:17,代码来源:model.endo.php


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