1: <?php
2: /**
3: * Used by the QCubed Code Generator to describe a column reference
4: * (aka a Foreign Key)
5: * @package Codegen
6: *
7: * @property string $KeyName
8: * @property string $Table
9: * @property string $Column
10: * @property string $PropertyName
11: * @property string $VariableName
12: * @property string $VariableType
13: * @property boolean $IsType
14: * @property QReverseReference ReverseReference
15: */
16: class QReference extends QBaseClass {
17:
18: /////////////////////////////
19: // Protected Member Variables
20: /////////////////////////////
21:
22: /**
23: * Name of the foreign key object, as defined in the database or create script
24: * @var string KeyName
25: */
26: protected $strKeyName;
27:
28: /**
29: * Name of the table that is being referenced
30: * @var string Table
31: */
32: protected $strTable;
33:
34: /**
35: * Name of the column that is being referenced
36: * @var string Column
37: */
38: protected $strColumn;
39:
40: /**
41: * Name of the referenced object as an class Property
42: * So if the column that this reference points from is named
43: * "primary_annual_report_id", it would be PrimaryAnnualReport
44: * @var string PropertyName
45: */
46: protected $strPropertyName;
47:
48: /**
49: * Name of the referenced object as an class protected Member object
50: * So if the column that this reference poitns from is named
51: * "primary_annual_report_id", it would be objPrimaryAnnualReport
52: * @var string VariableName
53: */
54: protected $strVariableName;
55:
56: /**
57: * The type of the protected member object (should be based off of $this->strTable)
58: * So if referencing the table "annual_report", it would be AnnualReport
59: * @var string VariableType
60: */
61: protected $strVariableType;
62:
63: /**
64: * If the table that this reference points to is a type table, then this is true
65: * @var string IsType
66: */
67: protected $blnIsType;
68:
69: /**
70: * The reverse reference pointing back to this reference.
71: *
72: * @var QReverseReference
73: */
74: protected $objReverseReference;
75:
76:
77:
78:
79: ////////////////////
80: // Public Overriders
81: ////////////////////
82:
83: /**
84: * Override method to perform a property "Get"
85: * This will get the value of $strName
86: *
87: * @param string $strName Name of the property to get
88: * @throws Exception
89: * @throws QCallerException
90: * @return mixed
91: */
92: public function __get($strName) {
93: switch ($strName) {
94: case 'KeyName':
95: return $this->strKeyName;
96: case 'Table':
97: return $this->strTable;
98: case 'Column':
99: return $this->strColumn;
100: case 'PropertyName':
101: return $this->strPropertyName;
102: case 'VariableName':
103: return $this->strVariableName;
104: case 'VariableType':
105: return $this->strVariableType;
106: case 'IsType':
107: return $this->blnIsType;
108: case 'ReverseReference':
109: return $this->objReverseReference;
110: default:
111: try {
112: return parent::__get($strName);
113: } catch (QCallerException $objExc) {
114: $objExc->IncrementOffset();
115: throw $objExc;
116: }
117: }
118: }
119:
120: /**
121: * Override method to perform a property "Set"
122: * This will set the property $strName to be $mixValue
123: *
124: * @param string $strName Name of the property to set
125: * @param string $mixValue New value of the property
126: * @throws Exception
127: * @throws QCallerException
128: * @return mixed
129: */
130: public function __set($strName, $mixValue) {
131: try {
132: switch ($strName) {
133: case 'KeyName':
134: return $this->strKeyName = QType::Cast($mixValue, QType::String);
135: case 'Table':
136: return $this->strTable = QType::Cast($mixValue, QType::String);
137: case 'Column':
138: return $this->strColumn = QType::Cast($mixValue, QType::String);
139: case 'PropertyName':
140: return $this->strPropertyName = QType::Cast($mixValue, QType::String);
141: case 'VariableName':
142: return $this->strVariableName = QType::Cast($mixValue, QType::String);
143: case 'VariableType':
144: return $this->strVariableType = QType::Cast($mixValue, QType::String);
145: case 'IsType':
146: return $this->blnIsType = QType::Cast($mixValue, QType::Boolean);
147: case 'ReverseReference':
148: return $this->objReverseReference = $mixValue;
149: default:
150: return parent::__set($strName, $mixValue);
151: }
152: } catch (QCallerException $objExc) {
153: $objExc->IncrementOffset();
154: throw $objExc;
155: }
156: }
157: }