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


PHP CActiveRecord::findAll方法代码示例

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


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

示例1: fetchData

 /**
  * fetch data
  */
 protected function fetchData()
 {
     $criteria = $this->_criteria;
     $criteria->offset = $this->_offset;
     $criteria->limit = $this->batchSize;
     $this->_batch = $this->_model->findAll($criteria);
     $this->_offset += $this->batchSize;
 }
开发者ID:Liv1020,项目名称:yii-batch-result,代码行数:11,代码来源:BatchResult.php

示例2: getValidParents

 public function getValidParents()
 {
     $result = array();
     $criteria = new CDbCriteria();
     if (!$this->_model->getIsNewRecord()) {
         $criteria->addNotInCondition($this->getPK(), $this->getDescendantsIds($this->_model));
     }
     foreach ($this->_model->findAll($criteria) as $model) {
         $result[$model->{$this->getPK()}] = $model->getCaption();
     }
     return $result;
 }
开发者ID:hit-shappens,项目名称:testapp,代码行数:12,代码来源:ParentChildARBehavior.php

示例3: findAll

 public function findAll($condition = '', $params = array())
 {
     $stores = parent::findAll($condition, $params);
     // add default store
     $default = self::getDefaultStore();
     array_unshift($stores, $default);
     return $stores;
 }
开发者ID:damnpoet,项目名称:yiicart,代码行数:8,代码来源:Store.php

示例4: rewind

 /**
  * {@inheritDoc}
  * @see Iterator::rewind()
  */
 public function rewind()
 {
     $this->_current_index = 0;
     $this->_criteria->offset = 0;
     $this->_max_count = (int) $this->_model->count($this->_criteria);
     $this->_current_records = $this->_model->findAll($this->_criteria);
     $this->_current_records_size = count($this->_current_records);
 }
开发者ID:anastaszor,项目名称:yii1-recorditerator,代码行数:12,代码来源:CRecordIterator.php

示例5: rewind

 /**
  * {@inheritDoc}
  * @see Iterator::rewind()
  */
 public function rewind()
 {
     $this->_current_index = 0;
     $this->_current_offset = 0;
     $this->_max_count = $this->_model->count($this->_criteria);
     $newcriteria = clone $this->_criteria;
     $this->_current_records = $this->_model->findAll($newcriteria);
     $this->_current_records_size = count($this->_current_records);
 }
开发者ID:anastaszor,项目名称:yii1-recorditerator,代码行数:13,代码来源:COrderedIterator.php

示例6: rewind

 /**
  * {@inheritDoc}
  * @see Iterator::rewind()
  */
 public function rewind()
 {
     $this->_current_index = 0;
     $this->_current_offset = 0;
     $timedCriteria = clone $this->_criteria;
     $timedCriteria->compare($this->_date_field, $this->_date_value);
     $this->_max_count = $this->_model->count($timedCriteria);
     $this->_current_records = $this->_model->findAll($timedCriteria);
     $this->_current_records_size = count($this->_current_records);
 }
开发者ID:anastaszor,项目名称:yii1-recorditerator,代码行数:14,代码来源:CTimedOrderedIterator.php

示例7: listData

 /**
  * @param CActiveRecord $model
  * @param string $valueField defaults to primary key field
  * @param string $textField defaults to primary key field
  * @return array
  */
 public static function listData($model, $valueField = '', $textField = '')
 {
     $pk = $model->metaData->tableSchema->primaryKey;
     if ($valueField === '') {
         $valueField = $pk;
     }
     if ($textField === '') {
         $textField = $valueField;
     }
     return CHtml::listData($model->findAll(array('select' => $valueField == $textField ? $valueField : $valueField . ',' . $textField)), $valueField, $textField);
 }
开发者ID:DarkAiR,项目名称:test,代码行数:17,代码来源:EHtml.php

示例8: GET_DATA_IN

 /**
  * @param CActiveRecord $model
  * @param string|array $inValues
  * @param string $column
  * @return CActiveRecord
  */
 public static function GET_DATA_IN($model, $column = 'id', $inValues)
 {
     $criteria = new CDbCriteria();
     if (is_string($inValues)) {
         $inValues = explode(',', $inValues);
     }
     $criteria->addInCondition($column, $inValues);
     return $model->findAll($criteria);
 }
开发者ID:edarkzero,项目名称:PetAdoption,代码行数:15,代码来源:ModelBase.php

示例9: GET_RANDOM_CRITERIA_OFFSET

 /**
  * @param CActiveRecord $model
  * @param CDbCriteria $criteria
  * @param int $length
  * @return CDbCriteria
  */
 public static function GET_RANDOM_CRITERIA_OFFSET($model, $criteria, $length = NULL)
 {
     $criteriaTmp = $criteria;
     $criteriaTmp->select = 't.id';
     $randomMax = count($model->findAll($criteriaTmp));
     if ($randomMax > $length) {
         if ($length == NULL) {
             $random = rand(0, $randomMax - 1);
         } else {
             $random = rand(0, $randomMax - $length);
         }
         $criteria->offset = $random;
     }
     return $criteria;
 }
开发者ID:edarkzero,项目名称:GineObs,代码行数:21,代码来源:ModelBase.php

示例10: findAllAttributes

 /**
  * Finds all active records satisfying the specified condition, selecting only the requested
  * attributes and, if specified, the primary keys.
  * See {@link CActiveRecord::find} for detailed explanation about $condition and $params.
  * #MethodTracker
  * This method is based on {@link CActiveRecord::findAll}, from version 1.1.7 (r3135). Changes:
  * <ul>
  * <li>Selects only the specified attributes.</li>
  * <li>Detects and selects the representing column.</li>
  * <li>Detects and selects the PK attribute.</li>
  * </ul>
  * @param string|array $attributes The names of the attributes to be selected.
  * Optional. If not specified, the {@link representingColumn} will be used.
  * @param boolean $withPk Specifies if the primary keys will be selected.
  * @param mixed $condition Query condition or criteria.
  * @param array $params Parameters to be bound to an SQL statement.
  * @return array List of active records satisfying the specified condition. An empty array is returned if none is found.
  * @uses representingColumn
  */
 public function findAllAttributes($attributes = null, $withPk = false, $condition = '', $params = array())
 {
     Yii::trace(get_class($this) . '.findAllAttributes()', 'giix.components.GxActiveRecord');
     $criteria = $this->getCommandBuilder()->createCriteria($condition, $params);
     if ($attributes === null) {
         $attributes = $this->representingColumn();
     }
     if ($withPk) {
         $pks = self::model(get_class($this))->getTableSchema()->primaryKey;
         if (!is_array($pks)) {
             $pks = array($pks);
         }
         if (!is_array($attributes)) {
             $attributes = array($attributes);
         }
         $attributes = array_merge($pks, $attributes);
     }
     $criteria->select = $attributes;
     return parent::findAll($criteria);
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:39,代码来源:GxActiveRecord.php

示例11: findAll

 /**
  *
  * @param string $condition
  * @param array $params
  * @return array 
  */
 public function findAll($condition = '', $params = array())
 {
     if (CStubActiveRecord::isUnittests()) {
         return CallFactory::call($this, 'findAll');
     }
     return parent::findAll($condition, $params);
 }
开发者ID:anton-itscript,项目名称:WM-Web,代码行数:13,代码来源:CStubActiveRecord.php

示例12: findAll

 public function findAll($condition = '', $params = array())
 {
     return $this->prepareRecords(parent::findAll($this->prepareCondition($condition), $params));
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-spa,代码行数:4,代码来源:EavActiveRecord.php

示例13: countTotalPages

 /**
  * Don't use now.
  *
  * @param \CActiveRecord $model - model class name.
  * @param array $params - params list.
  * @param int $page - current page.
  * @param int $min - left border
  * @param int $max - right border
  * @return int page number
  */
 private function countTotalPages($model, $params, $page, $min = 0, $max = 0)
 {
     if (!empty($model->findAll(array('limit' => 1, 'offset' => $params['limit'] * ($page - 1))))) {
         if (empty($model->findAll(array('limit' => 1, 'offset' => $params['limit'] * $page)))) {
             return $page;
         }
         $min = $page;
         $page = $max == 0 ? ceil($page * 1.5) : ceil($page + ($max - $page) / 2);
     } else {
         $max = $page;
         $page = $min == 0 ? ceil($page / 2) : ceil(($page - $min) * 1.5);
     }
     return $this->countTotalPages($model, $params, $page, $min, $max);
 }
开发者ID:JimmDiGriz,项目名称:HGApi,代码行数:24,代码来源:CoreApiController.php


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