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


PHP xPDOObject::_loadRows方法代码示例

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


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

示例1: listProfiles

    public static function listProfiles(xPDO &$xpdo, array $criteria = array(), array $sort = array('id' => 'ASC'), $limit = 0, $offset = 0) {
        $objCollection= array ();

        /* query for profiles */
        $c = $xpdo->newQuery('modFormCustomizationProfile');
        $c->select(array(
            $xpdo->getSelectColumns('modFormCustomizationProfile','modFormCustomizationProfile'),
        ));
        $c->where($criteria,null,2);// also log issue in remine to look at this usage of where()
        $count = $xpdo->getCount('modFormCustomizationProfile',$c);

        foreach($sort as $field=> $dir) {
            $c->sortby($xpdo->getSelectColumns('modFormCustomizationProfile','modFormCustomizationProfile','',array($field)),$dir);
        }
        if ((int) $limit > 0) {
            $c->limit((int) $limit, (int) $offset);
        }

        $rows= xPDOObject :: _loadRows($xpdo, 'modFormCustomizationProfile', $c);
        $rowsArray = $rows->fetchAll(PDO::FETCH_ASSOC);
        $rows->closeCursor();
        foreach($rowsArray as $row) {
            $objCollection[] = $xpdo->call('modFormCustomizationProfile', '_loadInstance', array(&$xpdo, 'modFormCustomizationProfile', $c, $row));
        }
        unset($row, $rowsArray);
        return array(
            'count'=> $count,
            'collection'=> $objCollection
        );
    }
开发者ID:raf3600,项目名称:revolution,代码行数:30,代码来源:modformcustomizationprofile.class.php

示例2: loadCollection

 /**
  * Custom collection loader that forces access policy checking.
  *
  * {@inheritdoc}
  */
 public static function loadCollection(xPDO &$xpdo, $className, $criteria = null, $cacheFlag = true)
 {
     $objCollection = array();
     if (!($className = $xpdo->loadClass($className))) {
         return $objCollection;
     }
     $rows = false;
     $fromCache = false;
     $collectionCaching = (int) $xpdo->getOption(xPDO::OPT_CACHE_DB_COLLECTIONS, array(), 1);
     if (!is_object($criteria)) {
         $criteria = $xpdo->getCriteria($className, $criteria, $cacheFlag);
     }
     if (is_object($criteria)) {
         if ($collectionCaching > 0 && $xpdo->_cacheEnabled && $cacheFlag) {
             $rows = $xpdo->fromCache($criteria, $className);
             $fromCache = is_array($rows) && !empty($rows);
         }
         if (!$fromCache) {
             $rows = xPDOObject::_loadRows($xpdo, $className, $criteria);
         }
         $cacheRows = array();
         if (is_array($rows)) {
             foreach ($rows as $row) {
                 if (modAccessibleObject::_loadCollectionInstance($xpdo, $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag)) {
                     if ($collectionCaching > 0 && $xpdo->_cacheEnabled && $cacheFlag && !$fromCache) {
                         $cacheRows[] = $row;
                     }
                 }
             }
         } elseif (is_object($rows)) {
             while ($row = $rows->fetch(PDO::FETCH_ASSOC)) {
                 if (modAccessibleObject::_loadCollectionInstance($xpdo, $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag)) {
                     if ($collectionCaching > 0 && $xpdo->_cacheEnabled && $cacheFlag && !$fromCache) {
                         $cacheRows[] = $row;
                     }
                 }
             }
         }
         if (!$fromCache && $xpdo->_cacheEnabled && $collectionCaching > 0 && $cacheFlag && !empty($cacheRows)) {
             $xpdo->toCache($criteria, $cacheRows, $cacheFlag);
         }
     } else {
         $xpdo->log(xPDO::LOG_LEVEL_ERROR, 'modAccessibleObject::loadCollection() - No valid statement could be found in or generated from the given criteria.');
     }
     return $objCollection;
 }
开发者ID:JoeBlow,项目名称:revolution,代码行数:51,代码来源:modaccessibleobject.class.php

示例3: loadCollection

 /**
  * Custom collection loader that forces access policy checking.
  *
  * {@inheritdoc}
  */
 public static function loadCollection(xPDO & $xpdo, $className, $criteria= null, $cacheFlag= true) {
     $objCollection= array ();
     $fromCache = false;
     if (!$className= $xpdo->loadClass($className)) return $objCollection;
     $rows= false;
     $fromCache= false;
     $collectionCaching = (integer) $xpdo->getOption(xPDO::OPT_CACHE_DB_COLLECTIONS, array(), 1);
     if (!is_object($criteria)) {
         $criteria= $xpdo->getCriteria($className, $criteria, $cacheFlag);
     }
     if ($collectionCaching > 0 && $xpdo->_cacheEnabled && $cacheFlag) {
         $rows= $xpdo->fromCache($criteria);
         $fromCache = (is_array($rows) && !empty($rows));
     }
     if (!$fromCache && is_object($criteria)) {
         $rows= xPDOObject :: _loadRows($xpdo, $className, $criteria);
     }
     if (is_array ($rows)) {
         foreach ($rows as $row) {
             modAccessibleObject :: _loadCollectionInstance($xpdo, $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag);
         }
     } elseif (is_object($rows)) {
         $cacheRows = array();
         while ($row = $rows->fetch(PDO::FETCH_ASSOC)) {
             modAccessibleObject :: _loadCollectionInstance($xpdo, $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag);
             if ($collectionCaching > 0 && $xpdo->_cacheEnabled && $cacheFlag && !$fromCache) $cacheRows[] = $row;
         }
         if ($collectionCaching > 0 && $xpdo->_cacheEnabled && $cacheFlag && !$fromCache) $rows =& $cacheRows;
     }
     if (!$fromCache && $xpdo->_cacheEnabled && $collectionCaching > 0 && $cacheFlag && !empty($rows)) {
         $xpdo->toCache($criteria, $rows, $cacheFlag);
     }
     return $objCollection;
 }
开发者ID:raf3600,项目名称:revolution,代码行数:39,代码来源:modaccessibleobject.class.php

示例4: _loadFieldData

 /**
  * Load persistent data from the source for the field(s) indicated.
  *
  * @access protected
  * @param string|array $fields A field name or array of field names to load
  * from the data source.
  */
 protected function _loadFieldData($fields)
 {
     if (!is_array($fields)) {
         $fields = array($fields);
     } else {
         $fields = array_values($fields);
     }
     $criteria = $this->xpdo->newQuery($this->_class, $this->getPrimaryKey());
     $criteria->select($fields);
     if ($rows = xPDOObject::_loadRows($this->xpdo, $this->_class, $criteria)) {
         $row = $rows->fetch(PDO::FETCH_ASSOC);
         $rows->closeCursor();
         $this->fromArray($row, '', false, true);
         $this->_lazy = array_diff($this->_lazy, $fields);
     }
 }
开发者ID:e-gob,项目名称:apps.gob.cl,代码行数:23,代码来源:xpdoobject.class.php

示例5: _loadCollection

 protected function _loadCollection($className, $criteria = null, $cacheFlag = true)
 {
     $xpdo =& $this->modx;
     $objCollection = array();
     $fromCache = false;
     if (!($className = $xpdo->loadClass($className))) {
         return $objCollection;
     }
     $rows = false;
     $fromCache = false;
     $collectionCaching = (int) $xpdo->getOption(xPDO::OPT_CACHE_DB_COLLECTIONS, array(), 1);
     if (!is_object($criteria)) {
         $criteria = $xpdo->getCriteria($className, $criteria, $cacheFlag);
     }
     if (!is_object($criteria) || !($criteria = $this->addDerivativeCriteria($className, $criteria))) {
         return $objCollection;
     }
     if ($collectionCaching > 0 && $xpdo->_cacheEnabled && $cacheFlag) {
         $rows = $xpdo->fromCache($criteria);
         $fromCache = is_array($rows) && !empty($rows);
     }
     if (!$fromCache && is_object($criteria)) {
         $rows = xPDOObject::_loadRows($xpdo, $className, $criteria);
     }
     if (is_array($rows)) {
         foreach ($rows as $row) {
             xPDOObject::_loadCollectionInstance($xpdo, $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag);
         }
     } elseif (is_object($rows)) {
         $cacheRows = array();
         while ($row = $rows->fetch(PDO::FETCH_ASSOC)) {
             xPDOObject::_loadCollectionInstance($xpdo, $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag);
             if ($collectionCaching > 0 && $xpdo->_cacheEnabled && $cacheFlag && !$fromCache) {
                 $cacheRows[] = $row;
             }
         }
         if ($collectionCaching > 0 && $xpdo->_cacheEnabled && $cacheFlag && !$fromCache) {
             $rows =& $cacheRows;
         }
     }
     if (!$fromCache && $xpdo->_cacheEnabled && $collectionCaching > 0 && $cacheFlag && !empty($rows)) {
         $xpdo->toCache($criteria, $rows, $cacheFlag);
     }
     return $objCollection;
 }
开发者ID:bendasvadim,项目名称:NewsModxBox,代码行数:45,代码来源:modsociety.class.php

示例6: _loadFieldData

 /**
  * Load persistent data from the source for the field(s) indicated.
  *
  * @access protected
  * @param string|array $fields A field name or array of field names to load
  * from the data source.
  */
 protected function _loadFieldData($fields) {
     if (!is_array($fields)) $fields= array($fields);
     else $fields= array_values($fields);
     $criteria= $this->xpdo->newQuery($this->_class, $this->getPrimaryKey());
     $criteria->select($fields);
     if ($rows= xPDOObject :: _loadRows($this->xpdo, $this->_class, $criteria)) {
         $row= reset($rows);
         $this->fromArray($row, '', false, true);
         $this->_lazy= array_diff($this->_lazy, $fields);
     }
 }
开发者ID:ncrossland,项目名称:revolution,代码行数:18,代码来源:xpdoobject.class.php


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