/** * 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 WikiVersionMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing WikiVersion object creation - defaults to CreateOrEdit * @return WikiVersionMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objWikiVersion = WikiVersion::Load($intId); // WikiVersion was found -- return it! if ($objWikiVersion) { return new WikiVersionMetaControl($objParentObject, $objWikiVersion); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a WikiVersion 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 WikiVersionMetaControl($objParentObject, new WikiVersion()); }
/** * 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 'Path': // Gets the value for strPath (Not Null) // @return string return $this->strPath; case 'WikiItemTypeId': // Gets the value for intWikiItemTypeId (Not Null) // @return integer return $this->intWikiItemTypeId; case 'EditorMinimumPersonTypeId': // Gets the value for intEditorMinimumPersonTypeId (Not Null) // @return integer return $this->intEditorMinimumPersonTypeId; case 'OverrideNavbarIndex': // Gets the value for intOverrideNavbarIndex // @return integer return $this->intOverrideNavbarIndex; case 'OverrideSubnavIndex': // Gets the value for intOverrideSubnavIndex // @return integer return $this->intOverrideSubnavIndex; case 'CurrentWikiVersionId': // Gets the value for intCurrentWikiVersionId (Unique) // @return integer return $this->intCurrentWikiVersionId; case 'CurrentName': // Gets the value for strCurrentName // @return string return $this->strCurrentName; case 'CurrentPostedByPersonId': // Gets the value for intCurrentPostedByPersonId // @return integer return $this->intCurrentPostedByPersonId; case 'CurrentPostDate': // Gets the value for dttCurrentPostDate // @return QDateTime return $this->dttCurrentPostDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'CurrentWikiVersion': // Gets the value for the WikiVersion object referenced by intCurrentWikiVersionId (Unique) // @return WikiVersion try { if (!$this->objCurrentWikiVersion && !is_null($this->intCurrentWikiVersionId)) { $this->objCurrentWikiVersion = WikiVersion::Load($this->intCurrentWikiVersionId); } return $this->objCurrentWikiVersion; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CurrentPostedByPerson': // Gets the value for the Person object referenced by intCurrentPostedByPersonId // @return Person try { if (!$this->objCurrentPostedByPerson && !is_null($this->intCurrentPostedByPersonId)) { $this->objCurrentPostedByPerson = Person::Load($this->intCurrentPostedByPersonId); } return $this->objCurrentPostedByPerson; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'TopicLink': // Gets the value for the TopicLink object that uniquely references this WikiItem // by objTopicLink (Unique) // @return TopicLink try { if ($this->objTopicLink === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objTopicLink) { $this->objTopicLink = TopicLink::LoadByWikiItemId($this->intId); } return $this->objTopicLink; } 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 '_WikiVersion': // Gets the value for the private _objWikiVersion (Read-Only) // if set due to an expansion on the wiki_version.wiki_item_id reverse relationship // @return WikiVersion return $this->_objWikiVersion; case '_WikiVersionArray': // Gets the value for the private _objWikiVersionArray (Read-Only) // if set due to an ExpandAsArray on the wiki_version.wiki_item_id reverse relationship // @return WikiVersion[] return (array) $this->_objWikiVersionArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Reload this WikiVersion 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 WikiVersion object.'); } // Reload the Object $objReloaded = WikiVersion::Load($this->intId); // Update $this's local variables to match $this->WikiItemId = $objReloaded->WikiItemId; $this->intVersionNumber = $objReloaded->intVersionNumber; $this->strName = $objReloaded->strName; $this->PostedByPersonId = $objReloaded->PostedByPersonId; $this->dttPostDate = $objReloaded->dttPostDate; }
/** * 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 'WikiVersionId': // Gets the value for intWikiVersionId (PK) // @return integer return $this->intWikiVersionId; case 'ImageFileTypeId': // Gets the value for intImageFileTypeId (Not Null) // @return integer return $this->intImageFileTypeId; case 'Width': // Gets the value for intWidth // @return integer return $this->intWidth; case 'Height': // Gets the value for intHeight // @return integer return $this->intHeight; case 'Description': // Gets the value for strDescription // @return string return $this->strDescription; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'WikiVersion': // Gets the value for the WikiVersion object referenced by intWikiVersionId (PK) // @return WikiVersion try { if (!$this->objWikiVersion && !is_null($this->intWikiVersionId)) { $this->objWikiVersion = WikiVersion::Load($this->intWikiVersionId); } return $this->objWikiVersion; } 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 '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * 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 'WikiVersionId': /** * Gets the value for intWikiVersionId (PK) * @return integer */ return $this->intWikiVersionId; case 'FileName': /** * Gets the value for strFileName * @return string */ return $this->strFileName; case 'FileSize': /** * Gets the value for intFileSize * @return integer */ return $this->intFileSize; case 'FileMime': /** * Gets the value for strFileMime * @return string */ return $this->strFileMime; case 'Description': /** * Gets the value for strDescription * @return string */ return $this->strDescription; case 'DownloadCount': /** * Gets the value for intDownloadCount * @return integer */ return $this->intDownloadCount; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'WikiVersion': /** * Gets the value for the WikiVersion object referenced by intWikiVersionId (PK) * @return WikiVersion */ try { if (!$this->objWikiVersion && !is_null($this->intWikiVersionId)) { $this->objWikiVersion = WikiVersion::Load($this->intWikiVersionId); } return $this->objWikiVersion; } 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 '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }