本文整理汇总了PHP中Package::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::Load方法的具体用法?PHP Package::Load怎么用?PHP Package::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::Load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Create
/**
* Static Helper Method to Create using PK arguments
* You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
* If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
* static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to
* edit, or if we are also allowed to create a new one, etc.
*
* @param mixed $objParentObject QForm or QPanel which will be using this PackageMetaControl
* @param integer $intId primary key value
* @param QMetaControlCreateType $intCreateType rules governing Package object creation - defaults to CreateOrEdit
* @return PackageMetaControl
*/
public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
{
// Attempt to Load from PK Arguments
if (strlen($intId)) {
$objPackage = Package::Load($intId);
// Package was found -- return it!
if ($objPackage) {
return new PackageMetaControl($objParentObject, $objPackage);
} else {
if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
throw new QCallerException('Could not find a Package object with PK arguments: ' . $intId);
}
}
// If EditOnly is specified, throw an exception
} else {
if ($intCreateType == QMetaControlCreateType::EditOnly) {
throw new QCallerException('No PK arguments specified');
}
}
// If we are here, then we need to create a new record
return new PackageMetaControl($objParentObject, new Package());
}
示例2: Reload
/**
* Reload this Package from the database.
* @return void
*/
public function Reload()
{
// Make sure we are actually Restored from the database
if (!$this->__blnRestored) {
throw new QCallerException('Cannot call Reload() on a new, unsaved Package object.');
}
// Reload the Object
$objReloaded = Package::Load($this->intId);
// Update $this's local variables to match
$this->PackageCategoryId = $objReloaded->PackageCategoryId;
$this->strToken = $objReloaded->strToken;
$this->strName = $objReloaded->strName;
$this->strDescription = $objReloaded->strDescription;
$this->dttLastPostDate = $objReloaded->dttLastPostDate;
$this->LastPostedByPersonId = $objReloaded->LastPostedByPersonId;
}
示例3: __get
/**
* Override method to perform a property "Get"
* This will get the value of $strName
*
* @param string $strName Name of the property to get
* @return mixed
*/
public function __get($strName)
{
switch ($strName) {
///////////////////
// Member Variables
///////////////////
case 'Id':
// Gets the value for intId (Read-Only PK)
// @return integer
return $this->intId;
case 'TopicLinkTypeId':
// Gets the value for intTopicLinkTypeId (Not Null)
// @return integer
return $this->intTopicLinkTypeId;
case 'TopicCount':
// Gets the value for intTopicCount
// @return integer
return $this->intTopicCount;
case 'MessageCount':
// Gets the value for intMessageCount
// @return integer
return $this->intMessageCount;
case 'LastPostDate':
// Gets the value for dttLastPostDate
// @return QDateTime
return $this->dttLastPostDate;
case 'ForumId':
// Gets the value for intForumId (Unique)
// @return integer
return $this->intForumId;
case 'IssueId':
// Gets the value for intIssueId (Unique)
// @return integer
return $this->intIssueId;
case 'WikiItemId':
// Gets the value for intWikiItemId (Unique)
// @return integer
return $this->intWikiItemId;
case 'PackageId':
// Gets the value for intPackageId (Unique)
// @return integer
return $this->intPackageId;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'Forum':
// Gets the value for the Forum object referenced by intForumId (Unique)
// @return Forum
try {
if (!$this->objForum && !is_null($this->intForumId)) {
$this->objForum = Forum::Load($this->intForumId);
}
return $this->objForum;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'Issue':
// Gets the value for the Issue object referenced by intIssueId (Unique)
// @return Issue
try {
if (!$this->objIssue && !is_null($this->intIssueId)) {
$this->objIssue = Issue::Load($this->intIssueId);
}
return $this->objIssue;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'WikiItem':
// Gets the value for the WikiItem object referenced by intWikiItemId (Unique)
// @return WikiItem
try {
if (!$this->objWikiItem && !is_null($this->intWikiItemId)) {
$this->objWikiItem = WikiItem::Load($this->intWikiItemId);
}
return $this->objWikiItem;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'Package':
// Gets the value for the Package object referenced by intPackageId (Unique)
// @return Package
try {
if (!$this->objPackage && !is_null($this->intPackageId)) {
$this->objPackage = Package::Load($this->intPackageId);
}
return $this->objPackage;
} catch (QCallerException $objExc) {
//.........这里部分代码省略.........
示例4: __get
/**
* Override method to perform a property "Get"
* This will get the value of $strName
*
* @param string $strName Name of the property to get
* @return mixed
*/
public function __get($strName)
{
switch ($strName) {
///////////////////
// Member Variables
///////////////////
case 'Id':
// Gets the value for intId (Read-Only PK)
// @return integer
return $this->intId;
case 'PackageId':
// Gets the value for intPackageId (Not Null)
// @return integer
return $this->intPackageId;
case 'PersonId':
// Gets the value for intPersonId (Not Null)
// @return integer
return $this->intPersonId;
case 'CurrentPackageVersionId':
// Gets the value for intCurrentPackageVersionId
// @return integer
return $this->intCurrentPackageVersionId;
case 'CurrentPostDate':
// Gets the value for dttCurrentPostDate
// @return QDateTime
return $this->dttCurrentPostDate;
case 'DownloadCount':
// Gets the value for intDownloadCount
// @return integer
return $this->intDownloadCount;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'Package':
// Gets the value for the Package object referenced by intPackageId (Not Null)
// @return Package
try {
if (!$this->objPackage && !is_null($this->intPackageId)) {
$this->objPackage = Package::Load($this->intPackageId);
}
return $this->objPackage;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'Person':
// Gets the value for the Person object referenced by intPersonId (Not Null)
// @return Person
try {
if (!$this->objPerson && !is_null($this->intPersonId)) {
$this->objPerson = Person::Load($this->intPersonId);
}
return $this->objPerson;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'CurrentPackageVersion':
// Gets the value for the PackageVersion object referenced by intCurrentPackageVersionId
// @return PackageVersion
try {
if (!$this->objCurrentPackageVersion && !is_null($this->intCurrentPackageVersionId)) {
$this->objCurrentPackageVersion = PackageVersion::Load($this->intCurrentPackageVersionId);
}
return $this->objCurrentPackageVersion;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
////////////////////////////
// Virtual Object References (Many to Many and Reverse References)
// (If restored via a "Many-to" expansion)
////////////////////////////
////////////////////////////
// Virtual Object References (Many to Many and Reverse References)
// (If restored via a "Many-to" expansion)
////////////////////////////
case '_PackageVersion':
// Gets the value for the private _objPackageVersion (Read-Only)
// if set due to an expansion on the package_version.package_contribution_id reverse relationship
// @return PackageVersion
return $this->_objPackageVersion;
case '_PackageVersionArray':
// Gets the value for the private _objPackageVersionArray (Read-Only)
// if set due to an ExpandAsArray on the package_version.package_contribution_id reverse relationship
// @return PackageVersion[]
return (array) $this->_objPackageVersionArray;
case '__Restored':
return $this->__blnRestored;
default:
//.........这里部分代码省略.........
示例5: DownloadPackage
/**
* @param string $strPackageName
* @param string $strUsername
* @param boolean $blnGzCompress
* @return string
*/
public function DownloadPackage($strPackageName, $strUsername, $blnGzCompress)
{
$objPerson = Person::LoadByUsername($strUsername);
$objPackage = Package::Load($this->GetPackageId($strPackageName));
if (!$objPerson) {
return null;
}
if (!$objPackage) {
return null;
}
$objPackageContribution = PackageContribution::LoadByPackageIdPersonId($objPackage->Id, $objPerson->Id);
if (!$objPackageContribution) {
return null;
}
if (!$objPackageContribution->CurrentPackageVersion) {
return null;
}
$objPackageContribution->CurrentPackageVersion->DownloadCount++;
$objPackageContribution->CurrentPackageVersion->Save();
$objPackageContribution->RefreshStats();
if ($blnGzCompress) {
$strPath = $objPackageContribution->CurrentPackageVersion->GetFilePathCompressed();
} else {
$strPath = $objPackageContribution->CurrentPackageVersion->GetFilePath();
}
header('Content-Length: ' . filesize($strPath));
return file_get_contents($strPath);
}