當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ElggEntity::load方法代碼示例

本文整理匯總了PHP中ElggEntity::load方法的典型用法代碼示例。如果您正苦於以下問題:PHP ElggEntity::load方法的具體用法?PHP ElggEntity::load怎麽用?PHP ElggEntity::load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ElggEntity的用法示例。


在下文中一共展示了ElggEntity::load方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: load

 /**
  * Override the load function.
  * This function will ensure that all data is loaded (were possible), so
  * if only part of the ElggObject is loaded, it'll load the rest.
  * 
  * @param int $guid
  * @return true|false 
  */
 protected function load($guid)
 {
     // Test to see if we have the generic stuff
     if (!parent::load($guid)) {
         return false;
     }
     // Check the type
     if ($this->attributes['type'] != 'object') {
         throw new InvalidClassException(sprintf(elgg_echo('InvalidClassException:NotValidElggStar'), $guid, get_class()));
     }
     // Load missing data
     $row = get_object_entity_as_row($guid);
     if ($row && !$this->isFullyLoaded()) {
         $this->attributes['tables_loaded']++;
     }
     // If $row isn't a cached copy then increment the counter
     // Now put these into the attributes array as core values
     $objarray = (array) $row;
     foreach ($objarray as $key => $value) {
         $this->attributes[$key] = $value;
     }
     return true;
 }
開發者ID:eokyere,項目名稱:elgg,代碼行數:31,代碼來源:objects.php

示例2: load

 /**
  * Loads the full ElggObject when given a guid.
  *
  * @param mixed $guid GUID of an ElggObject or the stdClass object from entities table
  *
  * @return bool
  * @throws InvalidClassException
  */
 protected function load($guid)
 {
     // Load data from entity table if needed
     if (!parent::load($guid)) {
         return false;
     }
     // Only work with GUID from here
     if ($guid instanceof stdClass) {
         $guid = $guid->guid;
     }
     // Check the type
     if ($this->attributes['type'] != 'object') {
         $msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
         throw new InvalidClassException($msg);
     }
     // Load missing data
     $row = get_object_entity_as_row($guid);
     if ($row && !$this->isFullyLoaded()) {
         // If $row isn't a cached copy then increment the counter
         $this->attributes['tables_loaded']++;
     }
     // Now put these into the attributes array as core values
     $objarray = (array) $row;
     foreach ($objarray as $key => $value) {
         $this->attributes[$key] = $value;
     }
     // guid needs to be an int  http://trac.elgg.org/ticket/4111
     $this->attributes['guid'] = (int) $this->attributes['guid'];
     return true;
 }
開發者ID:rcolomoc,項目名稱:Master-Red-Social,代碼行數:38,代碼來源:ElggObject.php

示例3: load

 /**
  * Loads the full ElggSite when given a guid.
  *
  * @param int $guid Guid of ElggSite entity
  *
  * @return bool
  * @throws InvalidClassException
  */
 protected function load($guid)
 {
     // Test to see if we have the generic stuff
     if (!parent::load($guid)) {
         return false;
     }
     // Check the type
     if ($this->attributes['type'] != 'site') {
         $msg = elgg_echo('InvalidClassException:NotValidElggStar', array($guid, get_class()));
         throw new InvalidClassException($msg);
     }
     // Load missing data
     $row = get_site_entity_as_row($guid);
     if ($row && !$this->isFullyLoaded()) {
         // If $row isn't a cached copy then increment the counter
         $this->attributes['tables_loaded']++;
     }
     // Now put these into the attributes array as core values
     $objarray = (array) $row;
     foreach ($objarray as $key => $value) {
         $this->attributes[$key] = $value;
     }
     // guid needs to be an int  http://trac.elgg.org/ticket/4111
     $this->attributes['guid'] = (int) $this->attributes['guid'];
     return true;
 }
開發者ID:portokallidis,項目名稱:Metamorphosis-Meducator,代碼行數:34,代碼來源:ElggSite.php


注:本文中的ElggEntity::load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。