本文整理匯總了PHP中Gdn_Model::GetID方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gdn_Model::GetID方法的具體用法?PHP Gdn_Model::GetID怎麽用?PHP Gdn_Model::GetID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gdn_Model
的用法示例。
在下文中一共展示了Gdn_Model::GetID方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: GetID
/**
* Returns a single message object for the specified id or FALSE if not found.
*
* @param int The MessageID to filter to.
*/
public function GetID($MessageID)
{
if (Gdn::Cache()->ActiveEnabled()) {
return self::Messages($MessageID);
} else {
return parent::GetID($MessageID);
}
}
示例2: GetID
/**
* Get a particular activity record.
*
* @since 2.0.0
* @access public
* @param int $ActivityID Unique ID of activity item.
* @return array|object A single SQL result.
*/
public function GetID($ActivityID, $DataType = FALSE)
{
$Activity = parent::GetID($ActivityID, $DataType);
if ($Activity) {
$this->CalculateRow($Activity);
$Activities = array($Activity);
self::JoinUsers($Activities);
$Activity = array_pop($Activities);
}
return $Activity;
}
示例3: GetID
public function GetID($ID, $DatasetType = DATASET_TYPE_OBJECT)
{
if (!$ID) {
return FALSE;
}
// Check page cache, then memcached
$User = $this->GetUserFromCache($ID, 'userid');
// If not, query DB
if ($User === Gdn_Cache::CACHEOP_FAILURE) {
$User = parent::GetID($ID, DATASET_TYPE_ARRAY);
if ($User) {
// If success, build more data, then cache user
$this->SetCalculatedFields($User);
$this->UserCache($User);
}
}
// Allow FALSE returns
if ($User === FALSE || is_null($User)) {
return FALSE;
}
if (is_array($User) && $DatasetType == DATASET_TYPE_OBJECT) {
$User = (object) $User;
}
if (is_object($User) && $DatasetType == DATASET_TYPE_ARRAY) {
$User = (array) $User;
}
$this->EventArguments['LoadedUser'] =& $User;
$this->FireEvent('AfterGetID');
return $User;
}
示例4: GetID
public function GetID($ID, $DatasetType = FALSE) {
$User = parent::GetID($ID, $DatasetType);
if ($User)
$this->SetCalculatedFields($User);
return $User;
}
示例5: GetID
public function GetID($ID, $DatasetType = DATASET_TYPE_OBJECT)
{
if (!$ID) {
return FALSE;
}
// Check page cache, then memcached
$User = $this->GetUserFromCache($ID, 'userid');
// If not, query DB
if ($User === Gdn_Cache::CACHEOP_FAILURE) {
$User = parent::GetID($ID, DATASET_TYPE_ARRAY);
// We want to cache a non-existant user no-matter what.
if (!$User) {
$User = NULL;
}
$this->UserCache($User, $ID);
} elseif (!$User) {
return FALSE;
}
// Apply calculated fields
$this->SetCalculatedFields($User);
// Allow FALSE returns
if ($User === FALSE || is_null($User)) {
return FALSE;
}
if (is_array($User) && $DatasetType == DATASET_TYPE_OBJECT) {
$User = (object) $User;
}
if (is_object($User) && $DatasetType == DATASET_TYPE_ARRAY) {
$User = (array) $User;
}
$this->EventArguments['LoadedUser'] =& $User;
$this->FireEvent('AfterGetID');
return $User;
}
示例6: GetID
/**
* {@inheritDoc}
* in addition; We CalculateRow on the record found (Add Attachments)
* @see Gdn_Model::GetID
*/
public function GetID($ID, $DatasetType = DATASET_TYPE_ARRAY, $Options = array())
{
$DatasetType = DATASET_TYPE_ARRAY;
$Row = (array) parent::GetID($ID, $DatasetType, $Options);
$this->CalculateRow($Row);
return $Row;
}