/** * Reload this PackageContribution 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 PackageContribution object.'); } // Reload the Object $objReloaded = PackageContribution::Load($this->intId); // Update $this's local variables to match $this->PackageId = $objReloaded->PackageId; $this->PersonId = $objReloaded->PersonId; $this->CurrentPackageVersionId = $objReloaded->CurrentPackageVersionId; $this->dttCurrentPostDate = $objReloaded->dttCurrentPostDate; $this->intDownloadCount = $objReloaded->intDownloadCount; }
/** * 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 'PackageContributionId': // Gets the value for intPackageContributionId (Not Null) // @return integer return $this->intPackageContributionId; case 'VersionNumber': // Gets the value for intVersionNumber (Not Null) // @return integer return $this->intVersionNumber; case 'Notes': // Gets the value for strNotes // @return string return $this->strNotes; case 'QcodoVersion': // Gets the value for strQcodoVersion // @return string return $this->strQcodoVersion; case 'NewFileCount': // Gets the value for intNewFileCount // @return integer return $this->intNewFileCount; case 'ChangedFileCount': // Gets the value for intChangedFileCount // @return integer return $this->intChangedFileCount; case 'PostDate': // Gets the value for dttPostDate // @return QDateTime return $this->dttPostDate; case 'DownloadCount': // Gets the value for intDownloadCount // @return integer return $this->intDownloadCount; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'PackageContribution': // Gets the value for the PackageContribution object referenced by intPackageContributionId (Not Null) // @return PackageContribution try { if (!$this->objPackageContribution && !is_null($this->intPackageContributionId)) { $this->objPackageContribution = PackageContribution::Load($this->intPackageContributionId); } return $this->objPackageContribution; } 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 '_PackageContributionAsCurrent': // Gets the value for the private _objPackageContributionAsCurrent (Read-Only) // if set due to an expansion on the package_contribution.current_package_version_id reverse relationship // @return PackageContribution return $this->_objPackageContributionAsCurrent; case '_PackageContributionAsCurrentArray': // Gets the value for the private _objPackageContributionAsCurrentArray (Read-Only) // if set due to an ExpandAsArray on the package_contribution.current_package_version_id reverse relationship // @return PackageContribution[] return (array) $this->_objPackageContributionAsCurrentArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * 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 PackageContributionMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing PackageContribution object creation - defaults to CreateOrEdit * @return PackageContributionMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objPackageContribution = PackageContribution::Load($intId); // PackageContribution was found -- return it! if ($objPackageContribution) { return new PackageContributionMetaControl($objParentObject, $objPackageContribution); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a PackageContribution 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 PackageContributionMetaControl($objParentObject, new PackageContribution()); }