1: <?php
2: /**
3: * Used by the QCubed Code Generator to describe a column reference from
4: * the table's perspective (aka a Foreign Key from the referenced Table's point of view)
5: * @package Codegen
6: *
7: * @property QReference $Reference
8: * @property string $KeyName
9: * @property string $Table
10: * @property string $Column
11: * @property boolean $NotNull
12: * @property boolean $Unique
13: * @property string $VariableName
14: * @property string $VariableType
15: * @property string $PropertyName
16: * @property string $ObjectDescription
17: * @property string $ObjectDescriptionPlural
18: * @property string $ObjectMemberVariable
19: * @property string $ObjectPropertyName
20: * @property array $Options
21: */
22: class QReverseReference extends QBaseClass {
23:
24: /////////////////////////////
25: // Protected Member Variables
26: /////////////////////////////
27:
28: /**
29: * The peer QReference object for which this object is the reverse reference of
30: * @var QReference KeyName
31: */
32: protected $objReference;
33:
34: /**
35: * Name of the foreign key object itself, as defined in the database or create script
36: * @var string KeyName
37: */
38: protected $strKeyName;
39:
40: /**
41: * Name of the referencing table (the table that owns the column that is the foreign key)
42: * @var string Table
43: */
44: protected $strTable;
45:
46: /**
47: * Name of the referencing column (the column that owns the foreign key)
48: * @var string Column
49: */
50: protected $strColumn;
51:
52: /**
53: * Specifies whether the referencing column is specified as "NOT NULL"
54: * @var bool NotNull
55: */
56: protected $blnNotNull;
57:
58: /**
59: * Specifies whether the referencing column is unique
60: * @var bool Unique
61: */
62: protected $blnUnique;
63:
64: /**
65: * Name of the reverse-referenced object as an function parameter.
66: * So if this is a reverse reference to "person" via "report.person_id",
67: * the VariableName would be "objReport"
68: * @var string VariableName
69: */
70: protected $strVariableName;
71:
72: /**
73: * Type of the reverse-referenced object as a class.
74: * So if this is a reverse reference to "person" via "report.person_id",
75: * the VariableName would be "Report"
76: * @var string VariableType
77: */
78: protected $strVariableType;
79:
80: /**
81: * Property Name of the referencing column (the column that owns the foreign key)
82: * in the associated Class. So if this is a reverse reference to the "person" table
83: * via the table/column "report.owner_person_id", the PropertyName would be "OwnerPersonId"
84: * @var string PropertyName
85: */
86: protected $strPropertyName;
87:
88: /**
89: * Singular object description used in the function names for the
90: * reverse reference. See documentation for more details.
91: * @var string ObjectDescription
92: */
93: protected $strObjectDescription;
94:
95: /**
96: * Plural object description used in the function names for the
97: * reverse reference. See documentation for more details.
98: * @var string ObjectDescriptionPlural
99: */
100: protected $strObjectDescriptionPlural;
101:
102: /**
103: * A member variable name to be used by classes that contain the local member variable
104: * for this unique reverse reference. Only aggregated when blnUnique is true.
105: * @var string ObjectMemberVariable
106: */
107: protected $strObjectMemberVariable;
108:
109: /**
110: * A property name to be used by classes that contain the property
111: * for this unique reverse reference. Only aggregated when blnUnique is true.
112: * @var string ObjectPropertyName
113: */
114: protected $strObjectPropertyName;
115:
116: /**
117: * Keyed array of overrides read from the override file
118: * @var array Overrides
119: */
120: protected $options;
121:
122:
123:
124:
125:
126: ////////////////////
127: // Public Overriders
128: ////////////////////
129:
130: /**
131: * Override method to perform a property "Get"
132: * This will get the value of $strName
133: *
134: * @param string $strName Name of the property to get
135: * @throws Exception
136: * @throws QCallerException
137: * @return mixed
138: */
139: public function __get($strName) {
140: switch ($strName) {
141: case 'Reference':
142: return $this->objReference;
143: case 'KeyName':
144: return $this->strKeyName;
145: case 'Table':
146: return $this->strTable;
147: case 'Column':
148: return $this->strColumn;
149: case 'NotNull':
150: return $this->blnNotNull;
151: case 'Unique':
152: return $this->blnUnique;
153: case 'VariableName':
154: return $this->strVariableName;
155: case 'VariableType':
156: return $this->strVariableType;
157: case 'PropertyName':
158: return $this->strPropertyName;
159: case 'ObjectDescription':
160: return $this->strObjectDescription;
161: case 'ObjectDescriptionPlural':
162: return $this->strObjectDescriptionPlural;
163: case 'ObjectMemberVariable':
164: return $this->strObjectMemberVariable;
165: case 'ObjectPropertyName':
166: return $this->strObjectPropertyName;
167: case 'Options':
168: return $this->options;
169:
170: default:
171: try {
172: return parent::__get($strName);
173: } catch (QCallerException $objExc) {
174: $objExc->IncrementOffset();
175: throw $objExc;
176: }
177: }
178: }
179:
180: /**
181: * Override method to perform a property "Set"
182: * This will set the property $strName to be $mixValue
183: *
184: * @param string $strName Name of the property to set
185: * @param string $mixValue New value of the property
186: * @throws Exception
187: * @throws QCallerException
188: * @return mixed
189: */
190: public function __set($strName, $mixValue) {
191: try {
192: switch ($strName) {
193: case 'Reference':
194: return $this->objReference = QType::Cast($mixValue, 'QReference');
195: case 'KeyName':
196: return $this->strKeyName = QType::Cast($mixValue, QType::String);
197: case 'Table':
198: return $this->strTable = QType::Cast($mixValue, QType::String);
199: case 'Column':
200: return $this->strColumn = QType::Cast($mixValue, QType::String);
201: case 'NotNull':
202: return $this->blnNotNull = QType::Cast($mixValue, QType::Boolean);
203: case 'Unique':
204: return $this->blnUnique = QType::Cast($mixValue, QType::Boolean);
205: case 'VariableName':
206: return $this->strVariableName = QType::Cast($mixValue, QType::String);
207: case 'VariableType':
208: return $this->strVariableType = QType::Cast($mixValue, QType::String);
209: case 'PropertyName':
210: return $this->strPropertyName = QType::Cast($mixValue, QType::String);
211: case 'ObjectDescription':
212: return $this->strObjectDescription = QType::Cast($mixValue, QType::String);
213: case 'ObjectDescriptionPlural':
214: return $this->strObjectDescriptionPlural = QType::Cast($mixValue, QType::String);
215: case 'ObjectMemberVariable':
216: return $this->strObjectMemberVariable = QType::Cast($mixValue, QType::String);
217: case 'ObjectPropertyName':
218: return $this->strObjectPropertyName = QType::Cast($mixValue, QType::String);
219: case 'Options':
220: return $this->options = QType::Cast($mixValue, QType::ArrayType);
221: default:
222: return parent::__set($strName, $mixValue);
223: }
224: } catch (QCallerException $objExc) {
225: $objExc->IncrementOffset();
226: throw $objExc;
227: }
228: }
229: }