/** * Reload this ClassGrade 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 ClassGrade object.'); } // Reload the Object $objReloaded = ClassGrade::Load($this->intId); // Update $this's local variables to match $this->strCode = $objReloaded->strCode; $this->strName = $objReloaded->strName; }
/** * 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 'SignupEntryId': // Gets the value for intSignupEntryId (PK) // @return integer return $this->intSignupEntryId; case 'ClassMeetingId': // Gets the value for intClassMeetingId (Not Null) // @return integer return $this->intClassMeetingId; case 'PersonId': // Gets the value for intPersonId (Not Null) // @return integer return $this->intPersonId; case 'ClassGradeId': // Gets the value for intClassGradeId // @return integer return $this->intClassGradeId; case 'ChildcareNotes': // Gets the value for strChildcareNotes // @return string return $this->strChildcareNotes; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'SignupEntry': // Gets the value for the SignupEntry object referenced by intSignupEntryId (PK) // @return SignupEntry try { if (!$this->objSignupEntry && !is_null($this->intSignupEntryId)) { $this->objSignupEntry = SignupEntry::Load($this->intSignupEntryId); } return $this->objSignupEntry; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ClassMeeting': // Gets the value for the ClassMeeting object referenced by intClassMeetingId (Not Null) // @return ClassMeeting try { if (!$this->objClassMeeting && !is_null($this->intClassMeetingId)) { $this->objClassMeeting = ClassMeeting::Load($this->intClassMeetingId); } return $this->objClassMeeting; } 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 'ClassGrade': // Gets the value for the ClassGrade object referenced by intClassGradeId // @return ClassGrade try { if (!$this->objClassGrade && !is_null($this->intClassGradeId)) { $this->objClassGrade = ClassGrade::Load($this->intClassGradeId); } return $this->objClassGrade; } 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 '_ClassAttendence': // Gets the value for the private _objClassAttendence (Read-Only) // if set due to an expansion on the class_attendence.class_registration_id reverse relationship // @return ClassAttendence return $this->_objClassAttendence; case '_ClassAttendenceArray': // Gets the value for the private _objClassAttendenceArray (Read-Only) // if set due to an ExpandAsArray on the class_attendence.class_registration_id reverse relationship // @return ClassAttendence[] return (array) $this->_objClassAttendenceArray; 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 ClassGradeMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing ClassGrade object creation - defaults to CreateOrEdit * @return ClassGradeMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objClassGrade = ClassGrade::Load($intId); // ClassGrade was found -- return it! if ($objClassGrade) { return new ClassGradeMetaControl($objParentObject, $objClassGrade); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a ClassGrade 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 ClassGradeMetaControl($objParentObject, new ClassGrade()); }