/** * 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 'SearchQueryId': // Gets the value for intSearchQueryId // @return integer return $this->intSearchQueryId; case 'OrQueryConditionId': // Gets the value for intOrQueryConditionId (Unique) // @return integer return $this->intOrQueryConditionId; case 'QueryOperationId': // Gets the value for intQueryOperationId (Not Null) // @return integer return $this->intQueryOperationId; case 'QueryNodeId': // Gets the value for intQueryNodeId (Not Null) // @return integer return $this->intQueryNodeId; case 'Value': // Gets the value for strValue // @return string return $this->strValue; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'SearchQuery': // Gets the value for the SearchQuery object referenced by intSearchQueryId // @return SearchQuery try { if (!$this->objSearchQuery && !is_null($this->intSearchQueryId)) { $this->objSearchQuery = SearchQuery::Load($this->intSearchQueryId); } return $this->objSearchQuery; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'OrQueryCondition': // Gets the value for the QueryCondition object referenced by intOrQueryConditionId (Unique) // @return QueryCondition try { if (!$this->objOrQueryCondition && !is_null($this->intOrQueryConditionId)) { $this->objOrQueryCondition = QueryCondition::Load($this->intOrQueryConditionId); } return $this->objOrQueryCondition; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'QueryOperation': // Gets the value for the QueryOperation object referenced by intQueryOperationId (Not Null) // @return QueryOperation try { if (!$this->objQueryOperation && !is_null($this->intQueryOperationId)) { $this->objQueryOperation = QueryOperation::Load($this->intQueryOperationId); } return $this->objQueryOperation; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'QueryNode': // Gets the value for the QueryNode object referenced by intQueryNodeId (Not Null) // @return QueryNode try { if (!$this->objQueryNode && !is_null($this->intQueryNodeId)) { $this->objQueryNode = QueryNode::Load($this->intQueryNodeId); } return $this->objQueryNode; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'QueryConditionAsOr': // Gets the value for the QueryCondition object that uniquely references this QueryCondition // by objQueryConditionAsOr (Unique) // @return QueryCondition try { if ($this->objQueryConditionAsOr === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objQueryConditionAsOr) { $this->objQueryConditionAsOr = QueryCondition::LoadByOrQueryConditionId($this->intId); } return $this->objQueryConditionAsOr; } 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; } } }
/** * 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 QueryOperationMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing QueryOperation object creation - defaults to CreateOrEdit * @return QueryOperationMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objQueryOperation = QueryOperation::Load($intId); // QueryOperation was found -- return it! if ($objQueryOperation) { return new QueryOperationMetaControl($objParentObject, $objQueryOperation); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a QueryOperation 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 QueryOperationMetaControl($objParentObject, new QueryOperation()); }
/** * Reload this QueryOperation 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 QueryOperation object.'); } // Reload the Object $objReloaded = QueryOperation::Load($this->intId); // Update $this's local variables to match $this->intQueryDataTypeBitmap = $objReloaded->intQueryDataTypeBitmap; $this->strName = $objReloaded->strName; $this->strQqFactoryName = $objReloaded->strQqFactoryName; $this->blnArgumentFlag = $objReloaded->blnArgumentFlag; $this->strArgumentPrepend = $objReloaded->strArgumentPrepend; $this->strArgumentPostpend = $objReloaded->strArgumentPostpend; }