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


PHP DataSource::read方法代码示例

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


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

示例1: read

 public function read(Model $model, $queryData = array(), $recursive = null)
 {
     parent::read($model, $queryData, $recursive);
     $services = array();
     if (!empty($queryData['conditions']['servicos'])) {
         if (is_array($queryData['conditions']['servicos'])) {
             foreach ($queryData['conditions']['servicos'] as $servico) {
                 $services[] = $this->services[$servico];
             }
         } else {
             $services = $this->services[$queryData['conditions']['servicos']];
         }
     } else {
         // SET DEFAULT FORMAT
         $this->format = ECTFormatos::FORMATO_CAIXA_PACOTE;
     }
     if (!empty($queryData['conditions']['formato'])) {
         $this->format = $queryData['conditions']['formato'];
     }
     // GET VALUES
     $return = $this->_getECTValues($queryData['conditions']['altura'], $queryData['conditions']['comprimento'], $queryData['conditions']['largura'], $queryData['conditions']['peso'], $queryData['conditions']['ceporigem'], $queryData['conditions']['cep'], $services, $this->format);
     // CONVERTS ARRAY ITERATOR TO ARRAY
     $return = iterator_to_array($return, true);
     // CONVERT ARRAY OBJECTS TO ARRAY
     $return = $this->_toArray($return);
     // INSERT MODEL NAME AND RETURNS
     return $this->_fixReturn($return);
 }
开发者ID:John-Henrique,项目名称:CakePHP-Correios-Datasource,代码行数:28,代码来源:CorreiosSource.php

示例2: read

 /**
  * Reads from cache if it exists. If not, it falls back to the original
  * datasource to retrieve the data and cache it for later
  *
  * @param Model $Model
  * @param array $queryData
  * @param integer $recursive
  * @return array Results
  * @see DataSource::read()
  */
 public function read(Model $Model, $queryData = array(), $recursive = null)
 {
     $this->_resetSource($Model);
     $key = $this->_key($Model, $queryData);
     $results = Cache::read($key, $this->config['config']);
     if ($results === false) {
         $results = $this->source->read($Model, $queryData, $recursive);
         // compress before storing
         if (isset($this->config['gzip'])) {
             Cache::write($key, gzcompress(serialize($results)), $this->config['config']);
         } else {
             Cache::write($key, $results, $this->config['config']);
         }
         $this->_map($Model, $key);
     } else {
         // uncompress data from cache
         if (isset($this->config['gzip'])) {
             $results = unserialize(gzuncompress($results));
         }
     }
     return $results;
 }
开发者ID:jeremyharris,项目名称:cacher,代码行数:32,代码来源:CacheSource.php

示例3: read

 /**
  * Reads from cache if it exists. If not, it falls back to the original
  * datasource to retrieve the data and cache it for later
  *
  * @param Model $model
  * @param array $query
  * @param int $recursive
  * @return array Results
  * @see DataSource::read()
  */
 public function read(Model $model, $query = array(), $recursive = null)
 {
     // Resets the model's datasource to the original
     $model->setDataSource(ConnectionManager::getSourceName($this->source));
     $key = $this->_key($model, $query);
     $results = Cache::read($key, $this->config['config']);
     if ($results === false) {
         $results = $this->source->read($model, $query, $recursive);
         // compress before storing
         if ($this->_useGzip()) {
             Cache::write($key, gzcompress(serialize($results)), $this->config['config']);
         } else {
             Cache::write($key, $results, $this->config['config']);
         }
         $this->_map($model, $key);
     } else {
         // uncompress data from cache
         if ($this->_useGzip()) {
             $results = unserialize(gzuncompress($results));
         }
     }
     Cache::set(null, $this->config['config']);
     return $results;
 }
开发者ID:oanhnn,项目名称:cache,代码行数:34,代码来源:CachedSource.php


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