/** * 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 'CompanyId': // Gets the value for intCompanyId (Read-Only PK) // @return integer return $this->intCompanyId; case 'AddressId': // Gets the value for intAddressId // @return integer return $this->intAddressId; case 'ShortDescription': // Gets the value for strShortDescription (Unique) // @return string return $this->strShortDescription; case 'Website': // Gets the value for strWebsite // @return string return $this->strWebsite; case 'Telephone': // Gets the value for strTelephone // @return string return $this->strTelephone; case 'Fax': // Gets the value for strFax // @return string return $this->strFax; case 'Email': // Gets the value for strEmail // @return string return $this->strEmail; case 'LongDescription': // Gets the value for strLongDescription // @return string return $this->strLongDescription; case 'CreatedBy': // Gets the value for intCreatedBy // @return integer return $this->intCreatedBy; case 'CreationDate': // Gets the value for dttCreationDate // @return QDateTime return $this->dttCreationDate; case 'ModifiedBy': // Gets the value for intModifiedBy // @return integer return $this->intModifiedBy; case 'ModifiedDate': // Gets the value for strModifiedDate (Read-Only Timestamp) // @return string return $this->strModifiedDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Address': // Gets the value for the Address object referenced by intAddressId // @return Address try { if (!$this->objAddress && !is_null($this->intAddressId)) { $this->objAddress = Address::Load($this->intAddressId); } return $this->objAddress; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': // Gets the value for the UserAccount object referenced by intCreatedBy // @return UserAccount try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': // Gets the value for the UserAccount object referenced by intModifiedBy // @return UserAccount try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CompanyCustomFieldHelper': // Gets the value for the CompanyCustomFieldHelper object that uniquely references this Company // by objCompanyCustomFieldHelper (Unique) // @return CompanyCustomFieldHelper try { if ($this->objCompanyCustomFieldHelper === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objCompanyCustomFieldHelper) { $this->objCompanyCustomFieldHelper = CompanyCustomFieldHelper::LoadByCompanyId($this->intCompanyId); } return $this->objCompanyCustomFieldHelper; } 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 '_Address': // Gets the value for the private _objAddress (Read-Only) // if set due to an expansion on the address.company_id reverse relationship // @return Address return $this->_objAddress; case '_AddressArray': // Gets the value for the private _objAddressArray (Read-Only) // if set due to an ExpandAsArray on the address.company_id reverse relationship // @return Address[] return (array) $this->_objAddressArray; case '_Contact': // Gets the value for the private _objContact (Read-Only) // if set due to an expansion on the contact.company_id reverse relationship // @return Contact return $this->_objContact; case '_ContactArray': // Gets the value for the private _objContactArray (Read-Only) // if set due to an ExpandAsArray on the contact.company_id reverse relationship // @return Contact[] return (array) $this->_objContactArray; case '_ReceiptAsFrom': // Gets the value for the private _objReceiptAsFrom (Read-Only) // if set due to an expansion on the receipt.from_company_id reverse relationship // @return Receipt return $this->_objReceiptAsFrom; case '_ReceiptAsFromArray': // Gets the value for the private _objReceiptAsFromArray (Read-Only) // if set due to an ExpandAsArray on the receipt.from_company_id reverse relationship // @return Receipt[] return (array) $this->_objReceiptAsFromArray; case '_ShipmentAsFrom': // Gets the value for the private _objShipmentAsFrom (Read-Only) // if set due to an expansion on the shipment.from_company_id reverse relationship // @return Shipment return $this->_objShipmentAsFrom; case '_ShipmentAsFromArray': // Gets the value for the private _objShipmentAsFromArray (Read-Only) // if set due to an ExpandAsArray on the shipment.from_company_id reverse relationship // @return Shipment[] return (array) $this->_objShipmentAsFromArray; case '_ShipmentAsTo': // Gets the value for the private _objShipmentAsTo (Read-Only) // if set due to an expansion on the shipment.to_company_id reverse relationship // @return Shipment return $this->_objShipmentAsTo; case '_ShipmentAsToArray': // Gets the value for the private _objShipmentAsToArray (Read-Only) // if set due to an ExpandAsArray on the shipment.to_company_id reverse relationship // @return Shipment[] return (array) $this->_objShipmentAsToArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Main utility method to aid with data binding. It is used by the default BindAllRows() databinder but * could and should be used by any custom databind methods that would be used for instances of this * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. * * If a paginator is set on this DataBinder, it will use it. If not, then no pagination will be used. * It will also perform any sorting (if applicable). * * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query * @return void */ public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null) { // Setup input parameters to default values if none passed in if (!$objCondition) { $objCondition = QQ::All(); } $objClauses = $objOptionalClauses ? $objOptionalClauses : array(); // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below if ($this->Paginator) { $this->TotalItemCount = CompanyCustomFieldHelper::QueryCount($objCondition, $objClauses); } // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add // the OrderByClause to the $objClauses array if ($objClause = $this->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be a Query result from CompanyCustomFieldHelper, given the clauses above $this->DataSource = CompanyCustomFieldHelper::QueryArray($objCondition, $objClauses); }
protected function UpdateCompanyFields() { $this->objCompany->AddressId = $this->lstAddress->SelectedValue; $this->objCompany->ShortDescription = $this->txtShortDescription->Text; $this->objCompany->Website = $this->txtWebsite->Text; $this->objCompany->Telephone = $this->txtTelephone->Text; $this->objCompany->Fax = $this->txtFax->Text; $this->objCompany->Email = $this->txtEmail->Text; $this->objCompany->LongDescription = $this->txtLongDescription->Text; $this->objCompany->CreatedBy = $this->lstCreatedByObject->SelectedValue; $this->objCompany->CreationDate = $this->calCreationDate->DateTime; $this->objCompany->ModifiedBy = $this->lstModifiedByObject->SelectedValue; $this->objCompany->CompanyCustomFieldHelper = CompanyCustomFieldHelper::Load($this->lstCompanyCustomFieldHelper->SelectedValue); }
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, CompanyCustomFieldHelper::GetSoapObjectFromObject($objObject, true)); } return unserialize(serialize($objArrayToReturn)); }
/** * 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 CompanyCustomFieldHelperMetaControl * @param integer $intCompanyId primary key value * @param QMetaControlCreateType $intCreateType rules governing CompanyCustomFieldHelper object creation - defaults to CreateOrEdit * @return CompanyCustomFieldHelperMetaControl */ public static function Create($objParentObject, $intCompanyId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intCompanyId)) { $objCompanyCustomFieldHelper = CompanyCustomFieldHelper::Load($intCompanyId); // CompanyCustomFieldHelper was found -- return it! if ($objCompanyCustomFieldHelper) { return new CompanyCustomFieldHelperMetaControl($objParentObject, $objCompanyCustomFieldHelper); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a CompanyCustomFieldHelper object with PK arguments: ' . $intCompanyId); } } // 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 CompanyCustomFieldHelperMetaControl($objParentObject, new CompanyCustomFieldHelper()); }
/** * This will save this object's Company instance, * updating only the fields which have had a control created for it. */ public function SaveCompany() { try { // Update any fields for controls that have been created if ($this->lstAddress) { $this->objCompany->AddressId = $this->lstAddress->SelectedValue; } if ($this->txtShortDescription) { $this->objCompany->ShortDescription = $this->txtShortDescription->Text; } if ($this->txtWebsite) { $this->objCompany->Website = $this->txtWebsite->Text; } if ($this->txtTelephone) { $this->objCompany->Telephone = $this->txtTelephone->Text; } if ($this->txtFax) { $this->objCompany->Fax = $this->txtFax->Text; } if ($this->txtEmail) { $this->objCompany->Email = $this->txtEmail->Text; } if ($this->txtLongDescription) { $this->objCompany->LongDescription = $this->txtLongDescription->Text; } if ($this->lstCreatedByObject) { $this->objCompany->CreatedBy = $this->lstCreatedByObject->SelectedValue; } if ($this->calCreationDate) { $this->objCompany->CreationDate = $this->calCreationDate->DateTime; } if ($this->lstModifiedByObject) { $this->objCompany->ModifiedBy = $this->lstModifiedByObject->SelectedValue; } // Update any UniqueReverseReferences (if any) for controls that have been created for it if ($this->lstCompanyCustomFieldHelper) { $this->objCompany->CompanyCustomFieldHelper = CompanyCustomFieldHelper::Load($this->lstCompanyCustomFieldHelper->SelectedValue); } // Save the Company object $this->objCompany->Save(); // Finally, update any ManyToManyReferences (if any) } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }