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


PHP AppModel::read方法代码示例

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


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

示例1: read

 public function read($fields = null, $id = null, $unify = true)
 {
     $category = parent::read($fields, $id);
     if (!empty($category) && $unify) {
         $category[is_string($unify) ? $unify : 'Category'] = $category[$this->alias];
     }
     return $category;
 }
开发者ID:wangshipeng,项目名称:license,代码行数:8,代码来源:Category.php

示例2: readCached

 /**
  *
  * @param AppModel $model
  * @param int $id
  */
 public function readCached($model, $id = null)
 {
     if (empty($id)) {
         $id = $model->getID();
     }
     $key = $model->Behaviors->enabled('Translate') ? Inflector::underscore($model->alias) . "_{$id}_" . SlConfigure::read('I18n.locale') : Inflector::underscore($model->alias) . "_{$id}";
     $data = Cache::read($key, 'models');
     if (empty($data)) {
         Cache::write($key, $data = $model->read(null, $id), 'models');
     }
     return $data;
 }
开发者ID:sandulungu,项目名称:StarLight,代码行数:17,代码来源:cacheable.php

示例3: isset

 /**
  *  SetById method. Check is model innitialized.
  *
  *  If $id is defined read record from model with this primary key value
  *
  * @param AppModel $model
  * @param ID $id  - value of model primary key to read
  * @return boolean True if model initialized, false if no info in $model->data exists.
  * @access private
  */
 function __setById(&$model, $id = null, $checkId = true)
 {
     if (!isset($id)) {
         if ($checkId) {
             return isset($model->data[$model->alias]['id']);
         } else {
             return isset($model->data[$model->alias]);
         }
     } else {
         return $model->read(null, $id);
     }
 }
开发者ID:Galvanio,项目名称:Kinspir,代码行数:22,代码来源:list.php

示例4: read

 function read($fields = null, $id = null)
 {
     $data = parent::read($fields, $id);
     if ($data) {
         if (!empty($data['CmsNode']['model'])) {
             $data2 = ClassRegistry::init("{$data['CmsNode']['plugin']}.{$data['CmsNode']['model']}")->read(null, $data['CmsNode']['foreign_key']);
             if ($data2) {
                 $data += $data2;
             } else {
                 $data = null;
             }
         }
     }
     return $data;
 }
开发者ID:sandulungu,项目名称:StarLight,代码行数:15,代码来源:cms_node.php

示例5: testTwitterSaveToken

 function testTwitterSaveToken()
 {
     $this->loadFixtures('UserToken');
     $this->TestModel = ClassRegistry::init('UserToken');
     $this->TestModel->Behaviors->attach('TwitterKit.Twitter');
     // --
     $this->TestModel->id = 4;
     $this->TestModel->twitterSetToken('dummy_token4', 'dummy_secret4');
     $result = $this->TestModel->twitterSaveToken();
     $this->assertTrue($result);
     $data = $this->TestModel->read();
     $this->assertEqual('dummy_token4', $data['UserToken']['oauth_token']);
     $this->assertEqual('dummy_secret4', $data['UserToken']['oauth_token_secret']);
     // --
     $this->TestModel->Behaviors->Twitter->DataSource->reset();
     $this->TestModel->Behaviors->detach('TwitterKit.Twitter');
     $this->TestModel->Behaviors->attach('TwitterKit.Twitter', array('fields' => array('oauth_token' => 'access_token', 'oauth_token_secret' => 'access_token_secret')));
     $this->TestModel->twitterSetToken('dummy_token5', 'dummy_secret5');
     $result = $this->TestModel->twitterSaveToken(5);
     $this->assertTrue($result);
     $data = $this->TestModel->read();
     $this->assertEqual('dummy_token5', $data['UserToken']['access_token']);
     $this->assertEqual('dummy_secret5', $data['UserToken']['access_token_secret']);
 }
开发者ID:elstc,项目名称:twitter_kit,代码行数:24,代码来源:twitter.test.php

示例6: beforeDelete

 /**
  * Callback
  * Populates the $Model->data with the current register that will be deleted
  * for the callback afterDelete
  *
  * @access public
  *
  * @param AppModel $Model
  * @param bool     $cascade
  *
  * @return bool|mixed
  */
 public function beforeDelete(&$Model, $cascade)
 {
     $Model->read();
     return true;
 }
开发者ID:rcaravita,项目名称:jodeljodel,代码行数:17,代码来源:generator_plus.php

示例7: AppModel

<?php

$obj = new AppModel($id);
$obj->useTable = 'pl_miejscowosci';
$obj->alias = 'Miejscowosc';
$obj->read();
return $this->DB->query('SELECT Powiat.id,Powiat.nazwa, Wojewodztwo.id, Wojewodztwo.nazwa FROM pl_powiaty Powiat, wojewodztwa Wojewodztwo WHERE Powiat.id = ' . $obj->data['Miejscowosc']['powiat_id'] . ' AND Wojewodztwo.id=' . $obj->data['Miejscowosc']['woj_id']);
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:7,代码来源:obszary.php

示例8: getparentnode

 /**
  * Get the parent node
  *
  * reads the parent id and returns this node
  *
  * @param AppModel $model
  * @param mixed $id The ID of the record to read
  * @param integer $recursive The number of levels deep to fetch associated records
  * @return array Array of data for the parent node
  * @access public
  */
 function getparentnode(&$model, $id = null, $fields = null, $recursive = -1)
 {
     if (empty($id)) {
         $id = $model->id;
     }
     extract($this->settings[$model->alias]);
     $parentId = $model->read($parent, $id);
     if ($parentId) {
         $parentId = $parentId[$model->alias][$parent];
         $parent = $model->find('first', array('conditions' => array($model->escapeField() => $parentId), 'fields' => $fields, 'recursive' => $recursive));
         return $parent;
     } else {
         return false;
     }
 }
开发者ID:kaz0636,项目名称:openflp,代码行数:26,代码来源:tree.php

示例9: twitterSetTokenById

 /**
  * set OAuth Access Token By Id
  *
  * @param AppModel $model
  * @param mixed    $id
  * @return true|false
  */
 public function twitterSetTokenById($model, $id = null)
 {
     if (is_null($id)) {
         $id = $model->id;
     }
     $data = $model->read($this->settings[$model->alias]['fields'], $id);
     if (empty($data[$model->alias])) {
         return false;
     }
     return $this->twitterSetToken($model, $data[$model->alias]);
 }
开发者ID:elstc,项目名称:twitter_kit,代码行数:18,代码来源:twitter.php

示例10: __setById

 /**
  *  SetById method. Check is model innitialized.
  *
  *  If $id is defined read record from model with this primary key value
  *
  * @param AppModel $model
  * @param ID $id  - value of model primary key to read
  * @return boolean True if model initialized, false if no info in $model->data exists.
  */
 private function __setById($model, $id = null, $checkId = true)
 {
     if (!isset($id)) {
         if ($checkId) {
             return isset($model->data[$model->alias][$model->primaryKey]);
         } else {
             return isset($model->data[$model->alias]);
         }
     } else {
         return $model->read(null, $id);
     }
 }
开发者ID:asadaqain,项目名称:Guide-on-the-Side,代码行数:21,代码来源:ListBehavior.php

示例11: read

 /**
  * undocumented function
  *
  * @param string $fields
  * @param string $id
  * @return void
  */
 function read($fields = null, $id = null)
 {
     $data = parent::read($fields, $id);
     $data['Project']['config'] = unserialize($data['Project']['config']);
     return $data;
 }
开发者ID:Theaxiom,项目名称:chaw-source,代码行数:13,代码来源:project.php

示例12: moveup

 /**
  * Move up element
  *
  * @param AppModel $Model Model instance
  * @param mixed $id The ID of the record to move
  * @param mixed $number how many places to move the node, or true to move to first position
  * @return boolean true on success, false on failure
  */
 public function moveup(&$Model, $id = null, $number = 1)
 {
     if (is_array($id)) {
         extract(array_merge(array('id' => null), $id));
     }
     if (!$number) {
         return false;
     }
     if (empty($id)) {
         $id = $Model->id;
     }
     $data = $Model->read(am($this->settings[$Model->alias]['order_field'], $this->settings[$Model->alias]['group_fields']), $id);
     $order = $data[$Model->alias][$this->settings[$Model->alias]['order_field']];
     if (is_int($number)) {
         $order -= abs($number);
     } elseif ($number === true) {
         $order = $this->settings[$Model->alias]['start_at'];
     } else {
         return false;
     }
     if ($order < $this->settings[$Model->alias]['start_at']) {
         $order = $this->settings[$Model->alias]['start_at'];
     }
     $Model->id = $id;
     return $Model->saveField($this->settings[$Model->alias]['order_field'], $order);
 }
开发者ID:Galvanio,项目名称:Kinspir,代码行数:34,代码来源:sequence.php

示例13: _getData

 /**
  *
  * @param AppModel $model 
  * @return array
  */
 protected function _getData($model)
 {
     $_recursive = $model->recursive;
     $model->recursive = -1;
     $data = $model->read(null, $model->id);
     $model->recursive = $_recursive;
     return $data[$model->alias];
 }
开发者ID:nojimage,项目名称:cakephp-recmod,代码行数:13,代码来源:recmod.php

示例14: getparentnode

 /**
  * Get the parent node
  *
  * reads the parent id and returns this node
  *
  * @param AppModel $model
  * @param mixed $id The ID of the record to read
  * @param integer $recursive The number of levels deep to fetch associated records
  * @return array Array of data for the parent node
  * @access public
  */
 function getparentnode(&$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->find(array($model->escapeField() => $parentId), $fields, null, $recursive);
         return $parent;
     } else {
         return false;
     }
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:26,代码来源:tree.php

示例15: getparentnode

 /**
  * Get the parent node
  *
  * reads the parent id and returns this node
  *
  * @param AppModel $Model Model instance
  * @param mixed $id The ID of the record to read
  * @param integer $recursive The number of levels deep to fetch associated records
  * @return array Array of data for the parent node
  * @access public
  */
 function getparentnode(&$Model, $id = null, $fields = null, $recursive = null)
 {
     if (is_array($id)) {
         extract(array_merge(array('id' => null), $id));
     }
     $overrideRecursive = $recursive;
     if (empty($id)) {
         $id = $Model->id;
     }
     extract($this->settings[$Model->alias]);
     if (!is_null($overrideRecursive)) {
         $recursive = $overrideRecursive;
     }
     $parentId = $Model->read($parent, $id);
     if ($parentId) {
         $parentId = $parentId[$Model->alias][$parent];
         $parent = $Model->find('first', array('conditions' => array($Model->escapeField() => $parentId), 'fields' => $fields, 'recursive' => $recursive));
         return $parent;
     }
     return false;
 }
开发者ID:jedt,项目名称:digital_products_store,代码行数:32,代码来源:tree.php


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