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


PHP ActiveRecordModel::getRecordSetArray方法代码示例

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


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

示例1: categories

 public function categories()
 {
     // get store categories
     $selected = array();
     foreach ($this->getStore()->getRelatedRecordSetArray('ClonedStoreCategory', select()) as $cat) {
         $selected[$cat['categoryID']] = true;
     }
     // load tree
     $rootID = 1;
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('Category', 'isEnabled'), true));
     $categories = ActiveRecordModel::getRecordSetArray('Category', Category::getInstanceByID($rootID, true)->getBranchFilter($f));
     $index = array($rootID => array('children' => array(), 'key' => 1, 'title' => 'Root', 'expand' => true));
     foreach ($categories as $key => $category) {
         $cat = array('key' => $category['ID'], 'title' => $category['name_lang']);
         if (isset($selected[$category['ID']]) || !empty($index[$category['parentNodeID']]['select'])) {
             $cat['select'] = true;
         }
         $index[$category['ID']] = $cat;
         $index[$category['parentNodeID']]['children'][] =& $index[$category['ID']];
     }
     $response = new ActionResponse();
     $response->set('tree', json_encode(array($index[1])));
     $response->set('store', $this->getStore()->toArray());
     return $response;
 }
开发者ID:saiber,项目名称:www,代码行数:25,代码来源:ClonedStoreController.php

示例2: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $f = new ARSelectFilter();
     $orderID = $request->get('orderID');
     if (intval($orderID) > 0) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('Shipment', 'orderID'), $orderID));
     } else {
         throw new Exception("Order ID is required");
     }
     $shipment = ActiveRecordModel::getRecordSetArray('Shipment', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($shipment) == 0) {
         throw new Exception('Shipment not found');
     }
     while ($ser = array_shift($shipment)) {
         $xmlShipment = $response->addChild('shipment');
         foreach ($ser as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xmlShipment->addChild($k, $v);
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:28,代码来源:ShipmentApi.php

示例3: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $f = new ARSelectFilter();
     $id = $request->get('ID');
     if (intval($id) > 0) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('BillingAddress', 'ID'), $id));
     } else {
         throw new Exception('Billing Address ID is required');
     }
     //$f->setOrder(MultiLingualObject::getLangOrderHandle(new ARFieldHandle('Category', 'name')));
     $shipping_address = ActiveRecordModel::getRecordSetArray('BillingAddress', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($shipping_address) == 0) {
         throw new Exception('BillingAddress not found');
     }
     while ($category = array_shift($shipping_address)) {
         $xmlNewsPost = $response->addChild('billing_address');
         foreach ($category as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xmlNewsPost->addChild($k, htmlentities($v));
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:29,代码来源:BillingAddressApi.php

示例4: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $f = new ARSelectFilter();
     $ID = $request->get('ID');
     if (!empty($countryID)) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('DeliveryZoneCountry', 'ID'), $ID));
     }
     $countryZones = ActiveRecordModel::getRecordSetArray('DeliveryZoneCountry', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($countryZones) == 0) {
         throw new Exception('DeliveryZoneCountry not found');
     }
     while ($country_zone = array_shift($countryZones)) {
         $xmlCountryZone = $response->addChild('delivery_zone_country');
         foreach ($country_zone as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xmlCountryZone->addChild($k, $v);
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:26,代码来源:DeliveryZoneCountryApi.php

示例5: getTopCustomers

 public function getTopCustomers()
 {
     $this->setDateHandle(new ARFieldHandle('CustomerOrder', 'dateCompleted'));
     $this->setChartType(self::TABLE);
     $q = $this->getQuery('ROUND(SUM(CustomerOrder.totalAmount * ' . $this->getCurrencyMultiplier() . '), 2)');
     $f = $q->getFilter();
     $f->resetOrder();
     $f->resetGrouping();
     $f->setOrder(new ARExpressionHandle('cnt'), 'DESC');
     $q->addField('userID');
     $f->setGrouping(new ARExpressionHandle('userID'));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isFinalized'), 1));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isCancelled'), 0));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isPaid'), 1));
     $f->setLimit(self::TABLE_LIMIT);
     $q->joinTable('CustomerOrder', 'User', 'userID', 'ID');
     $this->getReportData($q);
     $ids = array();
     foreach ($this->values as $product) {
         $ids[$product['userID']] = $product['cnt'];
     }
     // fetch user details
     $fields = array_flip(array('fullName', 'cnt'));
     foreach (ActiveRecordModel::getRecordSetArray('User', new ARSelectFilter(new INCond(new ARFieldHandle('User', 'ID'), array_keys($ids)))) as $user) {
         $user['cnt'] = $ids[$user['ID']];
         $ids[$user['ID']] = array_merge($fields, array_intersect_key($user, $fields));
     }
     $this->values = $ids;
 }
开发者ID:saiber,项目名称:livecart,代码行数:29,代码来源:CustomerReport.php

示例6: index

 public function index()
 {
     // get filter to select manufacturers of active products only
     $rootCat = Category::getRootNode();
     $f = new ARSelectFilter();
     $productFilter = new ProductFilter($rootCat, $f);
     $ids = $counts = array();
     foreach (ActiveRecordModel::getDataBySQL('SELECT DISTINCT(manufacturerID), COUNT(*) AS cnt FROM Product ' . $f->createString() . ' GROUP BY manufacturerID') as $row) {
         $ids[] = $row['manufacturerID'];
         $counts[$row['manufacturerID']] = $row['cnt'];
     }
     $f = new ARSelectFilter(new InCond(new ARFieldHandle('Manufacturer', 'ID'), $ids));
     $f->mergeCondition(new NotEqualsCond(new ARFieldHandle('Manufacturer', 'name'), ''));
     $f->setOrder(new ARFieldHandle('Manufacturer', 'name'));
     $manufacturers = ActiveRecordModel::getRecordSetArray('Manufacturer', $f);
     foreach ($manufacturers as &$manufacturer) {
         $manufacturer['url'] = $this->getManufacturerFilterUrl($manufacturer);
     }
     $this->addBreadCrumb($this->translate('_manufacturers'), '');
     $response = new ActionResponse();
     $response->setReference('manufacturers', $manufacturers);
     $response->set('counts', $counts);
     $response->set('rootCat', $rootCat->toArray());
     return $response;
 }
开发者ID:saiber,项目名称:www,代码行数:25,代码来源:ManufacturersController.php

示例7: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $f = new ARSelectFilter();
     $id = $request->get('ID');
     if (intval($id) > 0) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('NewsPost', 'ID'), $id));
     }
     $f->setOrder(new ARExpressionHandle('NewsPost.ID'), 'DESC');
     $newspost = ActiveRecordModel::getRecordSetArray('NewsPost', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($newspost) == 0) {
         throw new Exception('News post not found');
     }
     while ($category = array_shift($newspost)) {
         $xmlNewsPost = $response->addChild('newspost');
         foreach ($category as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xmlNewsPost->addChild($k, htmlentities($v));
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:27,代码来源:NewsPostApi.php

示例8: index

 /**
  *	Main settings page
  */
 public function index()
 {
     $f = new ARSelectFilter();
     $f->setOrder(new ARFieldHandle('StaticPage', 'position'));
     $f->setOrder(new ARFieldHandle('StaticPage', 'parentID'));
     $s = ActiveRecordModel::getRecordSetArray('StaticPage', $f);
     $pages = array();
     foreach ($s as $page) {
         $pointers[$page['ID']] = array('title' => $page['title_lang'], 'id' => $page['ID'], 'parentID' => $page['parentID']);
     }
     foreach ($pointers as $page) {
         if ($page['parentID'] && !empty($pointers[$page['parentID']])) {
             $root =& $pointers[$page['parentID']];
         } else {
             $root =& $pages;
         }
         $root['children'][] =& $pointers[$page['id']];
     }
     $response = new ActionResponse();
     $response->set('pages', json_encode($pages));
     $form = $this->getForm();
     $page = StaticPage::getNewInstance();
     $page->getSpecification()->setFormResponse($response, $form);
     $response->set('form', $form);
     $response->set('page', $page->toArray());
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:30,代码来源:StaticPageController.php

示例9: testAutoReference

 public function testAutoReference()
 {
     $child = ActiveRecordModel::getNewInstance('AutoReferenceChild');
     $child->name->set('child');
     $child->save();
     $parent = ActiveRecordModel::getNewInstance('AutoReferenceParent');
     $parent->setID(4);
     $parent->name->set('parent');
     $parent->reference->set($child);
     $parent->save();
     ActiveRecordModel::clearPool();
     // test loading data array
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('AutoReferenceParent', 'ID'), 4));
     $array = array_shift(ActiveRecordModel::getRecordSetArray('AutoReferenceParent', $f));
     $this->assertEqual($array['ID'], 4);
     $this->assertEqual($array['Reference']['name'], 'child');
     ActiveRecordModel::clearPool();
     // test loading instance by ID
     $newParent = ActiveRecordModel::getInstanceByID('AutoReferenceParent', 4, ActiveRecordModel::LOAD_DATA);
     $this->assertEqual($newParent->reference->get()->name->get(), 'child');
     $this->assertNotSame($parent, $newParent);
     $this->assertNotSame($child, $newParent->reference->get());
     // test loading record set
     $newParent = ActiveRecordModel::getRecordSet('AutoReferenceParent', $f)->get(0);
     $this->assertEqual($newParent->reference->get()->name->get(), 'child');
     $this->assertNotSame($parent, $newParent);
     $this->assertNotSame($child, $newParent->reference->get());
 }
开发者ID:saiber,项目名称:www,代码行数:28,代码来源:AutoReferenceTest.php

示例10: process

 public function process()
 {
     if (!$this->response instanceof ActionResponse) {
         return;
     }
     $products = $this->response->get('products');
     $ids = array();
     foreach ($products as $key => $product) {
         $ids[$product['ID']] = !empty($product['parentID']) ? $product['parentID'] : $product['ID'];
     }
     if (!$ids) {
         return;
     }
     $f = select(in(f('ProductImage.productID'), array_values($ids)), new LikeCond(f('ProductImage.title'), '%Virtual Mirror%'));
     $hasMirror = array();
     foreach (ActiveRecordModel::getRecordSetArray('ProductImage', $f) as $mirror) {
         $hasMirror[$mirror['productID']] = true;
     }
     foreach ($ids as $realID => $parentID) {
         if (!empty($hasMirror[$parentID])) {
             $hasMirror[$realID] = true;
         }
     }
     foreach ($products as $key => $product) {
         if ($hasMirror[$product['ID']]) {
             $products[$key]['hasMirror'] = true;
         }
     }
     $this->response->set('hasMirror', $hasMirror);
     $this->response->set('products', $products);
 }
开发者ID:saiber,项目名称:www,代码行数:31,代码来源:LoadMirror.php

示例11: index

 public function index()
 {
     $this->addIndexBreadCrumb();
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('NewsPost', 'isEnabled'), true));
     $f->setOrder(new ARFieldHandle('NewsPost', 'position'), 'DESC');
     return new ActionResponse('news', ActiveRecordModel::getRecordSetArray('NewsPost', $f));
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:NewsController.php

示例12: testEavQueue

 public function testEavQueue()
 {
     // set up Manufacturer records
     $field = EavField::getNewInstance('Manufacturer', EavField::DATATYPE_TEXT, EavField::TYPE_TEXT_SIMPLE);
     $field->save();
     $data = array('first', 'second', 'third');
     foreach ($data as $value) {
         $manufacturer = Manufacturer::getNewInstance($value);
         $manufacturer->getSpecification()->setAttributeValueByLang($field, 'en', $value . ' test');
         $manufacturer->save();
     }
     ActiveRecordModel::clearPool();
     // fetch them from database
     $manufacturers = ActiveRecordModel::getRecordSetArray('Manufacturer', new ARSelectFilter());
     foreach ($manufacturers as &$entry) {
         ActiveRecordModel::addToEavQueue('Manufacturer', $entry);
     }
     // duplicate
     $manufacturers = array_merge($manufacturers, $manufacturers);
     // load EAV data
     ActiveRecordModel::loadEav();
     foreach ($manufacturers as $man) {
         $this->assertEqual($man['name'] . ' test', $man['attributes'][$field->getID()]['value_en']);
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:25,代码来源:EavObjectTest.php

示例13: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $f = new ARSelectFilter();
     $id = $request->get('ID');
     if (!empty($id)) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('ProductVariation', 'ID'), $id));
     } else {
         throw new Exception('Product variation ID is required');
     }
     $product_variations = ActiveRecordModel::getRecordSetArray('ProductVariation', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($product_variations) == 0) {
         throw new Exception('Product variation not found');
     }
     while ($variation = array_shift($product_variations)) {
         $xml = $response->addChild('product_variation');
         foreach ($variation as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xml->addChild($k, $v);
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:28,代码来源:ProductVariationApi.php

示例14: index

 /**
  *	@role login
  */
 public function index()
 {
     $this->addAccountBreadcrumb();
     // get recent orders
     $f = new ARSelectFilter();
     $f->setLimit($this->config->get('USER_COUNT_RECENT_ORDERS'));
     $orders = $this->loadOrders($f);
     $orderArray = $this->getOrderArray($orders);
     // get downloadable items
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('CustomerOrder', 'userID'), $this->user->getID()));
     $f->setLimit(self::COUNT_RECENT_FILES);
     $response = new ActionResponse();
     $response->set('orders', $orderArray);
     $response->set('files', $this->loadDownloadableItems(new ARSelectFilter(new EqualsCond(new ARFieldHandle('CustomerOrder', 'userID'), $this->user->getID()))));
     // get unread messages
     ClassLoader::import('application.model.order.OrderNote');
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('OrderNote', 'userID'), $this->user->getID()));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('OrderNote', 'isAdmin'), 1));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('OrderNote', 'isRead'), 0));
     $f->setOrder(new ARFieldHandle('OrderNote', 'ID'), 'DESC');
     $response->set('notes', ActiveRecordModel::getRecordSetArray('OrderNote', $f, array('User')));
     // feedback/confirmation message that was stored in session by some other action
     $response->set('userConfirm', $this->session->pullValue('userConfirm'));
     return $response;
 }
开发者ID:saiber,项目名称:www,代码行数:28,代码来源:UserController.php

示例15: index

 public function index()
 {
     $f = new ARSelectFilter();
     $f->setOrder(new ARFieldHandle('NewsPost', 'position'), 'DESC');
     $response = new ActionResponse('newsList', ActiveRecordModel::getRecordSetArray('NewsPost', $f));
     $response->set('form', $this->buildForm());
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:8,代码来源:SiteNewsController.php


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