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


PHP aTools::cacheVirtualPage方法代码示例

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


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

示例1: cacheVirtualPages

 /**
  * 
  * We've fetched a page on our own using aPageTable::queryWithSlots and we want
  * to make Apostrophe aware of it so that areas on the current page that live on
  * that virtual page don't generate a superfluous second query. Can accept an array,
  * a collection or a single page object. Hydrates pages if needed (app_a_fasthydrate).
  * Returns an array of page objects for convenience in mapping them back to 
  * other objects they are associated with (necessary to leverage app_a_fasthydrate
  * in code like our blog plugin that associates a page with an object).
  *
  * @param array, Doctrine_Collection, aPage $pages
  */
 public static function cacheVirtualPages($pages)
 {
     $results = array();
     if (is_object($pages) && $pages instanceof Doctrine_Collection || is_array($pages)) {
         foreach ($pages as $page) {
             $results[] = aTools::cacheVirtualPage($page);
         }
     } else {
         $results[] = aTools::cacheVirtualPage($pages);
     }
     return $results;
 }
开发者ID:hashir,项目名称:UoA,代码行数:24,代码来源:BaseaTools.class.php

示例2: populatePages

 /**
  * Given an array of blogItems this function will populate its virtual page
  * areas with the current slot versions.
  * @param aBlogItem $blogItems
  */
 public static function populatePages($blogItems)
 {
     $pageIds = array();
     foreach ($blogItems as $aBlogItem) {
         $pageIds[] = $aBlogItem['page_id'];
     }
     $pages = array();
     if (count($pageIds)) {
         $q = aPageTable::queryWithSlots();
         $q->whereIn('id', $pageIds);
         $fast = sfConfig::get('app_a_fasthydrate', false);
         $pagesInfo = $q->execute(array(), $fast ? Doctrine::HYDRATE_ARRAY : Doctrine::HYDRATE_RECORD);
         foreach ($pagesInfo as $pageInfo) {
             $pages[] = aTools::cacheVirtualPage($pageInfo);
         }
     }
     $pagesById = aArray::listToHashById($pages);
     foreach ($blogItems as $aBlogItem) {
         if (isset($pagesById[$aBlogItem->page_id])) {
             $aBlogItem->Page = $pagesById[$aBlogItem->page_id];
         }
     }
 }
开发者ID:hashir,项目名称:UoA,代码行数:28,代码来源:PluginaBlogItemTable.class.php


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