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


PHP WikiPage::InstantiateDbRow方法代码示例

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


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

示例1: InstantiateCursor

 /**
  * Instantiate a single WikiPage object from a query cursor (e.g. a DB ResultSet).
  * Cursor is automatically moved to the "next row" of the result set.
  * Will return NULL if no cursor or if the cursor has no more rows in the resultset.
  * @param QDatabaseResultBase $objDbResult cursor resource
  * @return WikiPage next row resulting from the query
  */
 public static function InstantiateCursor(QDatabaseResultBase $objDbResult)
 {
     // If blank resultset, then return empty result
     if (!$objDbResult) {
         return null;
     }
     // If empty resultset, then return empty result
     $objDbRow = $objDbResult->GetNextRow();
     if (!$objDbRow) {
         return null;
     }
     // We need the Column Aliases
     $strColumnAliasArray = $objDbResult->QueryBuilder->ColumnAliasArray;
     if (!$strColumnAliasArray) {
         $strColumnAliasArray = array();
     }
     // Pull Expansions (if applicable)
     $strExpandAsArrayNodes = $objDbResult->QueryBuilder->ExpandAsArrayNodes;
     // Load up the return result with a row and return it
     return WikiPage::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, null, $strColumnAliasArray);
 }
开发者ID:qcodo,项目名称:qcodo-website,代码行数:28,代码来源:WikiPageGen.class.php

示例2: InstantiateDbRow

 /**
  * Instantiate a WikiVersion from a Database Row.
  * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  * is calling this WikiVersion::InstantiateDbRow in order to perform
  * early binding on referenced objects.
  * @param QDatabaseRowBase $objDbRow
  * @param string $strAliasPrefix
  * @param string $strExpandAsArrayNodes
  * @param QBaseClass $objPreviousItem
  * @param string[] $strColumnAliasArray
  * @return WikiVersion
  */
 public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array())
 {
     // If blank row, return null
     if (!$objDbRow) {
         return null;
     }
     // Create a new instance of the WikiVersion object
     $objToReturn = new WikiVersion();
     $objToReturn->__blnRestored = true;
     $strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
     $objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'wiki_item_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'wiki_item_id'] : $strAliasPrefix . 'wiki_item_id';
     $objToReturn->intWikiItemId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'version_number', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'version_number'] : $strAliasPrefix . 'version_number';
     $objToReturn->intVersionNumber = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'name'] : $strAliasPrefix . 'name';
     $objToReturn->strName = $objDbRow->GetColumn($strAliasName, 'VarChar');
     $strAliasName = array_key_exists($strAliasPrefix . 'posted_by_person_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'posted_by_person_id'] : $strAliasPrefix . 'posted_by_person_id';
     $objToReturn->intPostedByPersonId = $objDbRow->GetColumn($strAliasName, 'Integer');
     $strAliasName = array_key_exists($strAliasPrefix . 'post_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'post_date'] : $strAliasPrefix . 'post_date';
     $objToReturn->dttPostDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
     // Instantiate Virtual Attributes
     foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
         $strVirtualPrefix = $strAliasPrefix . '__';
         $strVirtualPrefixLength = strlen($strVirtualPrefix);
         if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix) {
             $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
         }
     }
     // Prepare to Check for Early/Virtual Binding
     if (!$strAliasPrefix) {
         $strAliasPrefix = 'wiki_version__';
     }
     // Check for WikiItem Early Binding
     $strAlias = $strAliasPrefix . 'wiki_item_id__id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objWikiItem = WikiItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wiki_item_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for PostedByPerson Early Binding
     $strAlias = $strAliasPrefix . 'posted_by_person_id__id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if (!is_null($objDbRow->GetColumn($strAliasName))) {
         $objToReturn->objPostedByPerson = Person::InstantiateDbRow($objDbRow, $strAliasPrefix . 'posted_by_person_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
     }
     // Check for WikiFile Unique ReverseReference Binding
     $strAlias = $strAliasPrefix . 'wikifile__wiki_version_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if ($objDbRow->ColumnExists($strAliasName)) {
         if (!is_null($objDbRow->GetColumn($strAliasName))) {
             $objToReturn->objWikiFile = WikiFile::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikifile__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
         } else {
             // We ATTEMPTED to do an Early Bind but the Object Doesn't Exist
             // Let's set to FALSE so that the object knows not to try and re-query again
             $objToReturn->objWikiFile = false;
         }
     }
     // Check for WikiImage Unique ReverseReference Binding
     $strAlias = $strAliasPrefix . 'wikiimage__wiki_version_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if ($objDbRow->ColumnExists($strAliasName)) {
         if (!is_null($objDbRow->GetColumn($strAliasName))) {
             $objToReturn->objWikiImage = WikiImage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikiimage__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
         } else {
             // We ATTEMPTED to do an Early Bind but the Object Doesn't Exist
             // Let's set to FALSE so that the object knows not to try and re-query again
             $objToReturn->objWikiImage = false;
         }
     }
     // Check for WikiItemAsCurrent Unique ReverseReference Binding
     $strAlias = $strAliasPrefix . 'wikiitemascurrent__id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if ($objDbRow->ColumnExists($strAliasName)) {
         if (!is_null($objDbRow->GetColumn($strAliasName))) {
             $objToReturn->objWikiItemAsCurrent = WikiItem::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikiitemascurrent__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
         } else {
             // We ATTEMPTED to do an Early Bind but the Object Doesn't Exist
             // Let's set to FALSE so that the object knows not to try and re-query again
             $objToReturn->objWikiItemAsCurrent = false;
         }
     }
     // Check for WikiPage Unique ReverseReference Binding
     $strAlias = $strAliasPrefix . 'wikipage__wiki_version_id';
     $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
     if ($objDbRow->ColumnExists($strAliasName)) {
         if (!is_null($objDbRow->GetColumn($strAliasName))) {
             $objToReturn->objWikiPage = WikiPage::InstantiateDbRow($objDbRow, $strAliasPrefix . 'wikipage__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
         } else {
//.........这里部分代码省略.........
开发者ID:qcodo,项目名称:qcodo-website,代码行数:101,代码来源:WikiVersionGen.class.php

示例3: InstantiateDbResult

 /**
  * Instantiate an array of WikiPages from a Database Result
  * @param DatabaseResultBase $objDbResult
  * @param string $strExpandAsArrayNodes
  * @param string[] $strColumnAliasArray
  * @return WikiPage[]
  */
 public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null)
 {
     $objToReturn = array();
     if (!$strColumnAliasArray) {
         $strColumnAliasArray = array();
     }
     // If blank resultset, then return empty array
     if (!$objDbResult) {
         return $objToReturn;
     }
     // Load up the return array with each row
     if ($strExpandAsArrayNodes) {
         $objLastRowItem = null;
         while ($objDbRow = $objDbResult->GetNextRow()) {
             $objItem = WikiPage::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objLastRowItem, $strColumnAliasArray);
             if ($objItem) {
                 $objToReturn[] = $objItem;
                 $objLastRowItem = $objItem;
             }
         }
     } else {
         while ($objDbRow = $objDbResult->GetNextRow()) {
             $objToReturn[] = WikiPage::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
         }
     }
     return $objToReturn;
 }
开发者ID:klucznik,项目名称:qcodo-website,代码行数:34,代码来源:WikiPageGen.class.php


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