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


PHP ActiveRecordModel::getFieldValues方法代码示例

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


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

示例1: process

 public function process($loadReferencedRecords = array())
 {
     set_time_limit(0);
     ignore_user_abort(true);
     $this->deleteCancelFile();
     $filter = $this->grid->getFilter();
     $filter->setLimit(0);
     $ids = array();
     foreach (ActiveRecordModel::getFieldValues($this->grid->getModelClass(), $filter, array('ID'), ActiveRecordModel::LOAD_REFERENCES) as $row) {
         $ids[] = $row['ID'];
     }
     $totalCount = count($ids);
     $progress = 0;
     $response = new JSONResponse(array('act' => $this->request->get('act')), 'success', $this->completionMessage);
     ActiveRecord::beginTransaction();
     $chunkSize = count($ids) / self::MASS_ACTION_CHUNK_SIZE > 5 ? self::MASS_ACTION_CHUNK_SIZE : ceil(count($ids) / 5);
     foreach (array_chunk($ids, $chunkSize) as $chunk) {
         $response->flush('|' . base64_encode(json_encode(array('total' => $totalCount, 'progress' => $progress, 'pid' => $this->pid))));
         $this->processSet(ActiveRecordModel::getRecordSet($this->grid->getModelClass(), new ARSelectFilter(new INCond(new ARFieldHandle($this->grid->getModelClass(), 'ID'), $chunk)), $loadReferencedRecords));
         $progress += count($chunk);
     }
     ActiveRecord::commit();
     $response->flush('|');
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:25,代码来源:MassActionProcessor.php

示例2: removeUnnecessaryCategoriesFromSnapshot

 public function removeUnnecessaryCategoriesFromSnapshot(ClonedStore $store)
 {
     $conds = array();
     foreach ($store->getRelatedRecordSet('ClonedStoreCategory', select(), 'Category') as $storeCat) {
         $cat = $storeCat->category->get();
         if (1 == $cat->getID()) {
             continue;
         }
         $cat->load();
         $cond = lte(f('Category.lft'), $cat->lft->get());
         $cond->addAND(gte(f('Category.rgt'), $cat->rgt->get()));
         $conds[] = $cond;
     }
     $this->flush(__LINE__);
     if (!$conds) {
         return;
     }
     $this->flush(__LINE__);
     $cond = new OrChainCondition($conds);
     $ids = array();
     foreach (ActiveRecordModel::getFieldValues('Category', select($cond), array('ID')) as $id) {
         $ids[] = array_shift($id);
     }
     $idstr = 'IN (' . implode(', ', $ids) . ')';
     // delete unused extra category references
     // ActiveRecord::executeUpdate('DELETE FROM ' . $this->importDatabase . '.ProductCategory WHERE categoryID NOT ' . $idstr);
     $this->flush(__LINE__);
     //var_dump('before: ' . array_shift(array_shift(ActiveRecord::getDataBySQL('SELECT COUNT(*) FROM ' . $this->importDatabase . '.Product'))));
     ActiveRecord::executeUpdate('DELETE FROM ' . $this->importDatabase . '.Product WHERE (categoryID NOT ' . $idstr . ') AND ((SELECT COUNT(*) FROM ' . $this->importDatabase . '.ProductCategory WHERE productID=Product.ID AND (ProductCategory.categoryID ' . $idstr . ')) = 0)');
     //echo 'DELETE FROM ' . $this->importDatabase . '.Product WHERE (categoryID NOT ' . $idstr . ') AND ((SELECT COUNT(*) FROM ' . $this->importDatabase . '.ProductCategory WHERE productID=Product.ID AND (ProductCategory.categoryID ' . $idstr . ')) = 0)';
     //var_dump('AFTER: ' . array_shift(array_shift(ActiveRecord::getDataBySQL('SELECT COUNT(*) FROM ' . $this->importDatabase . '.Product'))));
     //die('test');
     $this->flush(__LINE__);
     // fix main category
     ActiveRecord::executeUpdate('UPDATE ' . $this->importDatabase . '.Product SET categoryID=(SELECT categoryID FROM ' . $this->importDatabase . '.ProductCategory WHERE productID=Product.ID AND ProductCategory.categoryID IN (' . implode(',', $ids) . ') LIMIT 1) WHERE (parentID IS NULL) AND (categoryID NOT ' . $idstr . ')');
     $this->flush(__LINE__);
     // remove redundant extra categories
     ActiveRecord::executeUpdate('DELETE ' . $this->importDatabase . '.ProductCategory FROM ' . $this->importDatabase . '.ProductCategory LEFT JOIN ' . $this->importDatabase . '.Product ON ProductCategory.productID=Product.ID WHERE ProductCategory.categoryID=Product.categoryID');
     $this->flush(__LINE__);
     // delete unused products
     ActiveRecord::executeUpdate('DELETE FROM ' . $this->importDatabase . '.Product WHERE (categoryID IS NULL) AND (parentID IS NULL)');
     $this->flush(__LINE__);
     // get all remaining categories
     $sql = 'SELECT lft, rgt FROM ' . $this->importDatabase . '.Category WHERE ID IN (SELECT categoryID FROM ' . $this->importDatabase . '.ProductCategory)';
     $conds = array();
     foreach (ActiveRecordModel::getDataBySQL($sql) as $row) {
         $cond = lte(f('Category.lft'), $row['lft']);
         $cond->addAND(gte(f('Category.rgt'), $row['rgt']));
         $conds[] = $cond;
     }
     $this->flush(__LINE__);
     $cond = new OrChainCondition($conds);
     $ids = array();
     foreach (ActiveRecordModel::getFieldValues('Category', select($cond), array('ID')) as $id) {
         $ids[] = array_shift($id);
     }
     $this->flush(__LINE__);
     $allidstr = 'IN (' . implode(', ', $ids) . ')';
     // delete unused categories
     ActiveRecord::executeUpdate('DELETE FROM ' . $this->importDatabase . '.Category WHERE (ID<>1) AND (ID NOT ' . $idstr . ') AND (ID NOT ' . $allidstr . ')');
     $this->flush(__LINE__);
     // disable/enable existing products according to category selection
     $store->addQueuedQuery('UPDATE Category SET isEnabled=0 WHERE (ID NOT ' . $idstr . ') AND (ID NOT ' . $allidstr . ')');
     $store->addQueuedQuery('UPDATE Category SET isEnabled=1 WHERE ((ID ' . $idstr . ') OR (ID ' . $allidstr . ')) AND (COALESCE(LOCATE("|isEnabled|", protectedFields), 0) = 0)');
     $this->flush(__LINE__);
     $store->addQueuedQuery('UPDATE Product SET isEnabled=0 WHERE (parentID IS NULL) AND (categoryID NOT ' . $idstr . ') AND (categoryID NOT ' . $allidstr . ')');
     //$store->addQueuedQuery('UPDATE Product SET isEnabled=1 WHERE (parentID IS NULL) AND ((categoryID ' . $idstr . ') OR (categoryID ' . $allidstr . ')) AND (COALESCE(LOCATE("|isEnabled|", protectedFields), 0) = 0)');
     $this->flush(__LINE__);
 }
开发者ID:saiber,项目名称:www,代码行数:69,代码来源:ClonedStoreUpdater.php

示例3: previous

 public function previous($diff = -1)
 {
     $product = Product::getInstanceByID($this->request->get('id'), true, array('Category'));
     $this->category = !$this->request->get('category') ? $product->category->get() : Category::getInstanceByID($this->request->get('category'), true);
     $this->getAppliedFilters();
     $this->getSelectFilter();
     if ($this->request->get('quickShopSequence')) {
         $ids = json_decode($this->request->get('quickShopSequence'));
     } else {
         $ids = array();
         foreach (ActiveRecordModel::getFieldValues('Product', $this->productFilter->getSelectFilter(), array('ID'), array('Category')) as $row) {
             $ids[] = $row['ID'];
         }
     }
     $index = array_search($product->getID(), $ids);
     $prevIndex = $index + $diff;
     if ($prevIndex < 0) {
         $prevIndex = count($ids) - 1;
     } else {
         if ($prevIndex == count($ids)) {
             $prevIndex = 0;
         }
     }
     include_once ClassLoader::getRealPath('application.helper.smarty') . '/function.productUrl.php';
     if ('quickShop' == $this->request->get('originalAction')) {
         return new ActionRedirectResponse('product', 'quickShop', array('id' => $ids[$prevIndex], 'query' => $this->getContext()));
     } else {
         return new RedirectResponse(createProductUrl(array('product' => Product::getInstanceByID($ids[$prevIndex], true)->toArray(), 'query' => $this->getContext()), $this->application));
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:30,代码来源:ProductController.php

示例4: getActiveTimeList

 private function getActiveTimeList($date)
 {
     $f = new ARSelectFilter();
     $f->setCondition(new AndChainCondition(array(eq(f('EyeExamSchedule.date'), 'DATE(\'' . $date . '\')'), isnull(f('EyeExamSchedule.eyeExamRequestID')))));
     $f->setOrder(new ARFieldHandle('EyeExamSchedule', 'doctorName'), 'ASC');
     $f->setOrder(new ARFieldHandle('EyeExamSchedule', 'time'), 'ASC');
     $workingHours = ActiveRecordModel::getFieldValues('EyeExamSchedule', $f, array('ID', 'doctorName', 'time', 'isVisible'));
     return $workingHours;
 }
开发者ID:saiber,项目名称:www,代码行数:9,代码来源:EyeExamController.php


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