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


PHP AppModel::findById方法代码示例

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


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

示例1: sess_write

function sess_write($key, $value)
{
    // If the client doesn't have a session, and one isn't being created ($value), do nothing.
    if (empty($_COOKIE[session_name()]) && empty($value)) {
        return TRUE;
    }
    $Controller = getInstance()->Controller;
    $Session = new AppModel('Session');
    $result = $Session->findById($key);
    $user_id = 0;
    if (isset($Controller->User->user['id'])) {
        $user_id = $Controller->User->user['id'];
    }
    if (isset($result['Session']['id'])) {
        $Session->save(array('hostname' => $_SERVER['REMOTE_ADDR'], 'session' => $value), array('id' => $key));
    } else {
        $Session->create(array('id' => $key, 'hostname' => $_SERVER['REMOTE_ADDR'], 'session' => $value));
    }
    return TRUE;
}
开发者ID:nowk,项目名称:baseapp-framework,代码行数:20,代码来源:session_helper.php

示例2: extract

 /**
  * Get the parent node
  *
  * reads the parent id and returns this node
  *
  * @since 1.2
  * @param AppModel $model
  * @param mixed $id The ID of the record to read
  * @param int $recursive The number of levels deep to fetch associated records
  * @return array Array of data for the parent node
  * @access public
  */
 function get_parent_node(&$model, $id = null, $fields = null, $recursive = -1)
 {
     if (empty($id)) {
         $id = $model->id;
     }
     extract($this->settings[$model->name]);
     $parentId = $model->read($parent, $id);
     if ($parentId) {
         $parentId = $parentId[$model->name][$parent];
         $parent = $model->findById($parentId, $fields, null, $recursive);
         return $parent;
     } else {
         return false;
     }
 }
开发者ID:paulToro,项目名称:webrocket,代码行数:27,代码来源:tree.php

示例3: __insertAtPosition

 /**
  * Inserts an item on a certain position
  *
  * @param AppModel $model
  * @param $position
  * @return boolean
  */
 private function __insertAtPosition($model, $position)
 {
     extract($this->settings[$model->alias]);
     $data = $model->data;
     $model->data[$model->alias][$positionColumn] = 0;
     $model->save(null, array('validate' => $validate, 'callbacks' => $callbacks));
     $model->create($data);
     $model->recursive = 0;
     $model->findById($model->id);
     $this->removeFromList($model);
     $result = $this->__incrementPositionsOnLowerItems($model, $position);
     if ($position <= $this->__bottomPositionInList($model) + 1) {
         $model->data[$model->alias][$positionColumn] = $position;
         $result = $model->save(null, array('validate' => $validate, 'callbacks' => $callbacks));
     }
     return $result;
 }
开发者ID:beyondkeysystem,项目名称:testone,代码行数:24,代码来源:ListBehavior.php


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