A QCodo powered CMS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

812 lines
31 KiB

  1. <?php
  2. /**
  3. * The abstract TaxRateGen class defined here is
  4. * code-generated and contains all the basic CRUD-type functionality as well as
  5. * basic methods to handle relationships and index-based loading.
  6. *
  7. * To use, you should use the TaxRate subclass which
  8. * extends this TaxRateGen class.
  9. *
  10. * Because subsequent re-code generations will overwrite any changes to this
  11. * file, you should leave this file unaltered to prevent yourself from losing
  12. * any information or code changes. All customizations should be done by
  13. * overriding existing or implementing new methods, properties and variables
  14. * in the TaxRate class.
  15. *
  16. * @package Quinta CMS
  17. * @subpackage GeneratedDataObjects
  18. * @property-read integer $Id the value for intId (Read-Only PK)
  19. * @property integer $ZoneId the value for intZoneId (Unique)
  20. * @property double $Rate the value for fltRate (Not Null)
  21. * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
  22. */
  23. class TaxRateGen extends QBaseClass
  24. {
  25. ///////////////////////////////////////////////////////////////////////
  26. // PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
  27. ///////////////////////////////////////////////////////////////////////
  28. /////////// Object properties ////////////
  29. /**
  30. * Protected member variable that maps to the database PK Identity column tax_rate.id
  31. * @var integer intId
  32. *
  33. */
  34. protected $intId = null;
  35. /**
  36. * Protected member variable that maps to the database column tax_rate.zone_id
  37. * @var integer intZoneId
  38. *
  39. */
  40. protected $intZoneId = null;
  41. /**
  42. * Protected member variable that maps to the database column tax_rate.rate
  43. * @var double fltRate
  44. *
  45. */
  46. protected $fltRate = null;
  47. /**
  48. * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
  49. * columns from the run-time database query result for this object). Used by InstantiateDbRow and
  50. * GetVirtualAttribute.
  51. * @var string[] $__strVirtualAttributeArray
  52. */
  53. protected $__strVirtualAttributeArray = array();
  54. /**
  55. * Protected internal member variable that specifies whether or not this object is Restored from the database.
  56. * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
  57. * @var bool __blnRestored;
  58. */
  59. protected $__blnRestored;
  60. ///////////////////////////////
  61. // PROTECTED MEMBER OBJECTS
  62. ///////////////////////////////
  63. ///////////////////////////////
  64. // CLASS-WIDE LOAD AND COUNT METHODS
  65. ///////////////////////////////
  66. /**
  67. * Static method to retrieve the Database object that owns this class.
  68. * @return QDatabaseBase reference to the Database object that can query this class
  69. */
  70. public static function GetDatabase() {
  71. return QApplication::$Database[1];
  72. }
  73. /**
  74. * Load a TaxRate from PK Info
  75. * @param integer $intId
  76. * @return TaxRate
  77. */
  78. public static function Load($intId) {
  79. // Use QuerySingle to Perform the Query
  80. return TaxRate::QuerySingle(
  81. QQ::Equal(QQN::TaxRate()->Id, $intId)
  82. );
  83. }
  84. /**
  85. * Load all TaxRates
  86. * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  87. * @return TaxRate[]
  88. */
  89. public static function LoadAll($objOptionalClauses = null) {
  90. // Call TaxRate::QueryArray to perform the LoadAll query
  91. try {
  92. return TaxRate::QueryArray(QQ::All(), $objOptionalClauses);
  93. } catch (QCallerException $objExc) {
  94. $objExc->IncrementOffset();
  95. throw $objExc;
  96. }
  97. }
  98. /**
  99. * Count all TaxRates
  100. * @return int
  101. */
  102. public static function CountAll() {
  103. // Call TaxRate::QueryCount to perform the CountAll query
  104. return TaxRate::QueryCount(QQ::All());
  105. }
  106. ///////////////////////////////
  107. // QCODO QUERY-RELATED METHODS
  108. ///////////////////////////////
  109. /**
  110. * Internally called method to assist with calling Qcodo Query for this class
  111. * on load methods.
  112. * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
  113. * @param QQCondition $objConditions any conditions on the query, itself
  114. * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
  115. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
  116. * @param boolean $blnCountOnly only select a rowcount
  117. * @return string the query statement
  118. */
  119. protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
  120. // Get the Database Object for this Class
  121. $objDatabase = TaxRate::GetDatabase();
  122. // Create/Build out the QueryBuilder object with TaxRate-specific SELET and FROM fields
  123. $objQueryBuilder = new QQueryBuilder($objDatabase, 'tax_rate');
  124. TaxRate::GetSelectFields($objQueryBuilder);
  125. $objQueryBuilder->AddFromItem('tax_rate');
  126. // Set "CountOnly" option (if applicable)
  127. if ($blnCountOnly)
  128. $objQueryBuilder->SetCountOnlyFlag();
  129. // Apply Any Conditions
  130. if ($objConditions)
  131. try {
  132. $objConditions->UpdateQueryBuilder($objQueryBuilder);
  133. } catch (QCallerException $objExc) {
  134. $objExc->IncrementOffset();
  135. throw $objExc;
  136. }
  137. // Iterate through all the Optional Clauses (if any) and perform accordingly
  138. if ($objOptionalClauses) {
  139. if ($objOptionalClauses instanceof QQClause)
  140. $objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
  141. else if (is_array($objOptionalClauses))
  142. foreach ($objOptionalClauses as $objClause)
  143. $objClause->UpdateQueryBuilder($objQueryBuilder);
  144. else
  145. throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
  146. }
  147. // Get the SQL Statement
  148. $strQuery = $objQueryBuilder->GetStatement();
  149. // Prepare the Statement with the Query Parameters (if applicable)
  150. if ($mixParameterArray) {
  151. if (is_array($mixParameterArray)) {
  152. if (count($mixParameterArray))
  153. $strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
  154. // Ensure that there are no other Unresolved Named Parameters
  155. if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
  156. throw new QCallerException('Unresolved named parameters in the query');
  157. } else
  158. throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
  159. }
  160. // Return the Objects
  161. return $strQuery;
  162. }
  163. /**
  164. * Static Qcodo Query method to query for a single TaxRate object.
  165. * Uses BuildQueryStatment to perform most of the work.
  166. * @param QQCondition $objConditions any conditions on the query, itself
  167. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  168. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  169. * @return TaxRate the queried object
  170. */
  171. public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  172. // Get the Query Statement
  173. try {
  174. $strQuery = TaxRate::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
  175. } catch (QCallerException $objExc) {
  176. $objExc->IncrementOffset();
  177. throw $objExc;
  178. }
  179. // Perform the Query, Get the First Row, and Instantiate a new TaxRate object
  180. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  181. return TaxRate::InstantiateDbRow($objDbResult->GetNextRow(), null, null, null, $objQueryBuilder->ColumnAliasArray);
  182. }
  183. /**
  184. * Static Qcodo Query method to query for an array of TaxRate objects.
  185. * Uses BuildQueryStatment to perform most of the work.
  186. * @param QQCondition $objConditions any conditions on the query, itself
  187. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  188. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  189. * @return TaxRate[] the queried objects as an array
  190. */
  191. public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  192. // Get the Query Statement
  193. try {
  194. $strQuery = TaxRate::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
  195. } catch (QCallerException $objExc) {
  196. $objExc->IncrementOffset();
  197. throw $objExc;
  198. }
  199. // Perform the Query and Instantiate the Array Result
  200. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  201. return TaxRate::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
  202. }
  203. /**
  204. * Static Qcodo Query method to query for a count of TaxRate objects.
  205. * Uses BuildQueryStatment to perform most of the work.
  206. * @param QQCondition $objConditions any conditions on the query, itself
  207. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  208. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  209. * @return integer the count of queried objects as an integer
  210. */
  211. public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  212. // Get the Query Statement
  213. try {
  214. $strQuery = TaxRate::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
  215. } catch (QCallerException $objExc) {
  216. $objExc->IncrementOffset();
  217. throw $objExc;
  218. }
  219. // Perform the Query and return the row_count
  220. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  221. // Figure out if the query is using GroupBy
  222. $blnGrouped = false;
  223. if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
  224. if ($objClause instanceof QQGroupBy) {
  225. $blnGrouped = true;
  226. break;
  227. }
  228. }
  229. if ($blnGrouped)
  230. // Groups in this query - return the count of Groups (which is the count of all rows)
  231. return $objDbResult->CountRows();
  232. else {
  233. // No Groups - return the sql-calculated count(*) value
  234. $strDbRow = $objDbResult->FetchRow();
  235. return QType::Cast($strDbRow[0], QType::Integer);
  236. }
  237. }
  238. /* public static function QueryArrayCached($strConditions, $mixParameterArray = null) {
  239. // Get the Database Object for this Class
  240. $objDatabase = TaxRate::GetDatabase();
  241. // Lookup the QCache for This Query Statement
  242. $objCache = new QCache('query', 'tax_rate_' . serialize($strConditions));
  243. if (!($strQuery = $objCache->GetData())) {
  244. // Not Found -- Go ahead and Create/Build out a new QueryBuilder object with TaxRate-specific fields
  245. $objQueryBuilder = new QQueryBuilder($objDatabase);
  246. TaxRate::GetSelectFields($objQueryBuilder);
  247. TaxRate::GetFromFields($objQueryBuilder);
  248. // Ensure the Passed-in Conditions is a string
  249. try {
  250. $strConditions = QType::Cast($strConditions, QType::String);
  251. } catch (QCallerException $objExc) {
  252. $objExc->IncrementOffset();
  253. throw $objExc;
  254. }
  255. // Create the Conditions object, and apply it
  256. $objConditions = eval('return ' . $strConditions . ';');
  257. // Apply Any Conditions
  258. if ($objConditions)
  259. $objConditions->UpdateQueryBuilder($objQueryBuilder);
  260. // Get the SQL Statement
  261. $strQuery = $objQueryBuilder->GetStatement();
  262. // Save the SQL Statement in the Cache
  263. $objCache->SaveData($strQuery);
  264. }
  265. // Prepare the Statement with the Parameters
  266. if ($mixParameterArray)
  267. $strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
  268. // Perform the Query and Instantiate the Array Result
  269. $objDbResult = $objDatabase->Query($strQuery);
  270. return TaxRate::InstantiateDbResult($objDbResult);
  271. }*/
  272. /**
  273. * Updates a QQueryBuilder with the SELECT fields for this TaxRate
  274. * @param QQueryBuilder $objBuilder the Query Builder object to update
  275. * @param string $strPrefix optional prefix to add to the SELECT fields
  276. */
  277. public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
  278. if ($strPrefix) {
  279. $strTableName = $strPrefix;
  280. $strAliasPrefix = $strPrefix . '__';
  281. } else {
  282. $strTableName = 'tax_rate';
  283. $strAliasPrefix = '';
  284. }
  285. $objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
  286. $objBuilder->AddSelectItem($strTableName, 'zone_id', $strAliasPrefix . 'zone_id');
  287. $objBuilder->AddSelectItem($strTableName, 'rate', $strAliasPrefix . 'rate');
  288. }
  289. ///////////////////////////////
  290. // INSTANTIATION-RELATED METHODS
  291. ///////////////////////////////
  292. /**
  293. * Instantiate a TaxRate from a Database Row.
  294. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  295. * is calling this TaxRate::InstantiateDbRow in order to perform
  296. * early binding on referenced objects.
  297. * @param DatabaseRowBase $objDbRow
  298. * @param string $strAliasPrefix
  299. * @param string $strExpandAsArrayNodes
  300. * @param QBaseClass $objPreviousItem
  301. * @param string[] $strColumnAliasArray
  302. * @return TaxRate
  303. */
  304. public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) {
  305. // If blank row, return null
  306. if (!$objDbRow)
  307. return null;
  308. // Create a new instance of the TaxRate object
  309. $objToReturn = new TaxRate();
  310. $objToReturn->__blnRestored = true;
  311. $strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
  312. $objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
  313. $strAliasName = array_key_exists($strAliasPrefix . 'zone_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'zone_id'] : $strAliasPrefix . 'zone_id';
  314. $objToReturn->intZoneId = $objDbRow->GetColumn($strAliasName, 'Integer');
  315. $strAliasName = array_key_exists($strAliasPrefix . 'rate', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'rate'] : $strAliasPrefix . 'rate';
  316. $objToReturn->fltRate = $objDbRow->GetColumn($strAliasName, 'Float');
  317. // Instantiate Virtual Attributes
  318. foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
  319. $strVirtualPrefix = $strAliasPrefix . '__';
  320. $strVirtualPrefixLength = strlen($strVirtualPrefix);
  321. if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
  322. $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
  323. }
  324. // Prepare to Check for Early/Virtual Binding
  325. if (!$strAliasPrefix)
  326. $strAliasPrefix = 'tax_rate__';
  327. return $objToReturn;
  328. }
  329. /**
  330. * Instantiate an array of TaxRates from a Database Result
  331. * @param DatabaseResultBase $objDbResult
  332. * @param string $strExpandAsArrayNodes
  333. * @param string[] $strColumnAliasArray
  334. * @return TaxRate[]
  335. */
  336. public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
  337. $objToReturn = array();
  338. if (!$strColumnAliasArray)
  339. $strColumnAliasArray = array();
  340. // If blank resultset, then return empty array
  341. if (!$objDbResult)
  342. return $objToReturn;
  343. // Load up the return array with each row
  344. if ($strExpandAsArrayNodes) {
  345. $objLastRowItem = null;
  346. while ($objDbRow = $objDbResult->GetNextRow()) {
  347. $objItem = TaxRate::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objLastRowItem, $strColumnAliasArray);
  348. if ($objItem) {
  349. $objToReturn[] = $objItem;
  350. $objLastRowItem = $objItem;
  351. }
  352. }
  353. } else {
  354. while ($objDbRow = $objDbResult->GetNextRow())
  355. $objToReturn[] = TaxRate::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
  356. }
  357. return $objToReturn;
  358. }
  359. ///////////////////////////////////////////////////
  360. // INDEX-BASED LOAD METHODS (Single Load and Array)
  361. ///////////////////////////////////////////////////
  362. /**
  363. * Load a single TaxRate object,
  364. * by Id Index(es)
  365. * @param integer $intId
  366. * @return TaxRate
  367. */
  368. public static function LoadById($intId) {
  369. return TaxRate::QuerySingle(
  370. QQ::Equal(QQN::TaxRate()->Id, $intId)
  371. );
  372. }
  373. /**
  374. * Load a single TaxRate object,
  375. * by ZoneId Index(es)
  376. * @param integer $intZoneId
  377. * @return TaxRate
  378. */
  379. public static function LoadByZoneId($intZoneId) {
  380. return TaxRate::QuerySingle(
  381. QQ::Equal(QQN::TaxRate()->ZoneId, $intZoneId)
  382. );
  383. }
  384. /**
  385. * Load an array of TaxRate objects,
  386. * by Rate Index(es)
  387. * @param double $fltRate
  388. * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  389. * @return TaxRate[]
  390. */
  391. public static function LoadArrayByRate($fltRate, $objOptionalClauses = null) {
  392. // Call TaxRate::QueryArray to perform the LoadArrayByRate query
  393. try {
  394. return TaxRate::QueryArray(
  395. QQ::Equal(QQN::TaxRate()->Rate, $fltRate),
  396. $objOptionalClauses);
  397. } catch (QCallerException $objExc) {
  398. $objExc->IncrementOffset();
  399. throw $objExc;
  400. }
  401. }
  402. /**
  403. * Count TaxRates
  404. * by Rate Index(es)
  405. * @param double $fltRate
  406. * @return int
  407. */
  408. public static function CountByRate($fltRate) {
  409. // Call TaxRate::QueryCount to perform the CountByRate query
  410. return TaxRate::QueryCount(
  411. QQ::Equal(QQN::TaxRate()->Rate, $fltRate)
  412. );
  413. }
  414. ////////////////////////////////////////////////////
  415. // INDEX-BASED LOAD METHODS (Array via Many to Many)
  416. ////////////////////////////////////////////////////
  417. //////////////////////////
  418. // SAVE, DELETE AND RELOAD
  419. //////////////////////////
  420. /**
  421. * Save this TaxRate
  422. * @param bool $blnForceInsert
  423. * @param bool $blnForceUpdate
  424. * @return int
  425. */
  426. public function Save($blnForceInsert = false, $blnForceUpdate = false) {
  427. // Get the Database Object for this Class
  428. $objDatabase = TaxRate::GetDatabase();
  429. $mixToReturn = null;
  430. try {
  431. if ((!$this->__blnRestored) || ($blnForceInsert)) {
  432. // Perform an INSERT query
  433. $objDatabase->NonQuery('
  434. INSERT INTO `tax_rate` (
  435. `zone_id`,
  436. `rate`
  437. ) VALUES (
  438. ' . $objDatabase->SqlVariable($this->intZoneId) . ',
  439. ' . $objDatabase->SqlVariable($this->fltRate) . '
  440. )
  441. ');
  442. // Update Identity column and return its value
  443. $mixToReturn = $this->intId = $objDatabase->InsertId('tax_rate', 'id');
  444. } else {
  445. // Perform an UPDATE query
  446. // First checking for Optimistic Locking constraints (if applicable)
  447. // Perform the UPDATE query
  448. $objDatabase->NonQuery('
  449. UPDATE
  450. `tax_rate`
  451. SET
  452. `zone_id` = ' . $objDatabase->SqlVariable($this->intZoneId) . ',
  453. `rate` = ' . $objDatabase->SqlVariable($this->fltRate) . '
  454. WHERE
  455. `id` = ' . $objDatabase->SqlVariable($this->intId) . '
  456. ');
  457. }
  458. } catch (QCallerException $objExc) {
  459. $objExc->IncrementOffset();
  460. throw $objExc;
  461. }
  462. // Update __blnRestored and any Non-Identity PK Columns (if applicable)
  463. $this->__blnRestored = true;
  464. // Return
  465. return $mixToReturn;
  466. }
  467. /**
  468. * Delete this TaxRate
  469. * @return void
  470. */
  471. public function Delete() {
  472. if ((is_null($this->intId)))
  473. throw new QUndefinedPrimaryKeyException('Cannot delete this TaxRate with an unset primary key.');
  474. // Get the Database Object for this Class
  475. $objDatabase = TaxRate::GetDatabase();
  476. // Perform the SQL Query
  477. $objDatabase->NonQuery('
  478. DELETE FROM
  479. `tax_rate`
  480. WHERE
  481. `id` = ' . $objDatabase->SqlVariable($this->intId) . '');
  482. }
  483. /**
  484. * Delete all TaxRates
  485. * @return void
  486. */
  487. public static function DeleteAll() {
  488. // Get the Database Object for this Class
  489. $objDatabase = TaxRate::GetDatabase();
  490. // Perform the Query
  491. $objDatabase->NonQuery('
  492. DELETE FROM
  493. `tax_rate`');
  494. }
  495. /**
  496. * Truncate tax_rate table
  497. * @return void
  498. */
  499. public static function Truncate() {
  500. // Get the Database Object for this Class
  501. $objDatabase = TaxRate::GetDatabase();
  502. // Perform the Query
  503. $objDatabase->NonQuery('
  504. TRUNCATE `tax_rate`');
  505. }
  506. /**
  507. * Reload this TaxRate from the database.
  508. * @return void
  509. */
  510. public function Reload() {
  511. // Make sure we are actually Restored from the database
  512. if (!$this->__blnRestored)
  513. throw new QCallerException('Cannot call Reload() on a new, unsaved TaxRate object.');
  514. // Reload the Object
  515. $objReloaded = TaxRate::Load($this->intId);
  516. // Update $this's local variables to match
  517. $this->ZoneId = $objReloaded->ZoneId;
  518. $this->fltRate = $objReloaded->fltRate;
  519. }
  520. ////////////////////
  521. // GETTORS AND SETTORS
  522. ////////////////////
  523. /**
  524. * Lookup a VirtualAttribute value (if applicable). Returns NULL if none found.
  525. * @param string $strName
  526. * @return string
  527. */
  528. public function GetVirtualAttribute($strName)
  529. {
  530. if (array_key_exists($strName, $this->__strVirtualAttributeArray))
  531. return $this->__strVirtualAttributeArray[$strName];
  532. return null;
  533. }
  534. /**
  535. * Override method to perform a property "Get"
  536. * This will get the value of $strName
  537. *
  538. * @param string $strName Name of the property to get
  539. * @return mixed
  540. */
  541. public function __get($strName)
  542. {
  543. switch ($strName)
  544. {
  545. ///////////////////
  546. // Member Variables
  547. ///////////////////
  548. case 'Id':
  549. /**
  550. * Gets the value for intId (Read-Only PK)
  551. * @return integer
  552. */
  553. return $this->intId;
  554. case 'ZoneId':
  555. /**
  556. * Gets the value for intZoneId (Unique)
  557. * @return integer
  558. */
  559. return $this->intZoneId;
  560. case 'Rate':
  561. /**
  562. * Gets the value for fltRate (Not Null)
  563. * @return double
  564. */
  565. return $this->fltRate;
  566. ///////////////////
  567. // Member Objects
  568. ///////////////////
  569. ////////////////////////////
  570. // Virtual Object References (Many to Many and Reverse References)
  571. // (If restored via a "Many-to" expansion)
  572. ////////////////////////////
  573. case '__Restored':
  574. return $this->__blnRestored;
  575. default:
  576. try {
  577. return parent::__get($strName);
  578. } catch (QCallerException $objExc) {
  579. $objExc->IncrementOffset();
  580. throw $objExc;
  581. }
  582. }
  583. }
  584. /**
  585. * Override method to perform a property "Set"
  586. * This will set the property $strName to be $mixValue
  587. *
  588. * @param string $strName Name of the property to set
  589. * @param string $mixValue New value of the property
  590. * @return mixed
  591. */
  592. public function __set($strName, $mixValue) {
  593. switch ($strName) {
  594. ///////////////////
  595. // Member Variables
  596. ///////////////////
  597. case 'ZoneId':
  598. /**
  599. * Sets the value for intZoneId (Unique)
  600. * @param integer $mixValue
  601. * @return integer
  602. */
  603. try {
  604. return ($this->intZoneId = QType::Cast($mixValue, QType::Integer));
  605. } catch (QCallerException $objExc) {
  606. $objExc->IncrementOffset();
  607. throw $objExc;
  608. }
  609. case 'Rate':
  610. /**
  611. * Sets the value for fltRate (Not Null)
  612. * @param double $mixValue
  613. * @return double
  614. */
  615. try {
  616. return ($this->fltRate = QType::Cast($mixValue, QType::Float));
  617. } catch (QCallerException $objExc) {
  618. $objExc->IncrementOffset();
  619. throw $objExc;
  620. }
  621. ///////////////////
  622. // Member Objects
  623. ///////////////////
  624. default:
  625. try {
  626. return parent::__set($strName, $mixValue);
  627. } catch (QCallerException $objExc) {
  628. $objExc->IncrementOffset();
  629. throw $objExc;
  630. }
  631. }
  632. }
  633. ///////////////////////////////
  634. // ASSOCIATED OBJECTS' METHODS
  635. ///////////////////////////////
  636. }
  637. /////////////////////////////////////
  638. // ADDITIONAL CLASSES for QCODO QUERY
  639. /////////////////////////////////////
  640. class QQNodeTaxRate extends QQNode {
  641. protected $strTableName = 'tax_rate';
  642. protected $strPrimaryKey = 'id';
  643. protected $strClassName = 'TaxRate';
  644. public function __get($strName) {
  645. switch ($strName) {
  646. case 'Id':
  647. return new QQNode('id', 'Id', 'integer', $this);
  648. case 'ZoneId':
  649. return new QQNode('zone_id', 'ZoneId', 'integer', $this);
  650. case 'Rate':
  651. return new QQNode('rate', 'Rate', 'double', $this);
  652. case '_PrimaryKeyNode':
  653. return new QQNode('id', 'Id', 'integer', $this);
  654. default:
  655. try {
  656. return parent::__get($strName);
  657. } catch (QCallerException $objExc) {
  658. $objExc->IncrementOffset();
  659. throw $objExc;
  660. }
  661. }
  662. }
  663. }
  664. class QQReverseReferenceNodeTaxRate extends QQReverseReferenceNode {
  665. protected $strTableName = 'tax_rate';
  666. protected $strPrimaryKey = 'id';
  667. protected $strClassName = 'TaxRate';
  668. public function __get($strName) {
  669. switch ($strName) {
  670. case 'Id':
  671. return new QQNode('id', 'Id', 'integer', $this);
  672. case 'ZoneId':
  673. return new QQNode('zone_id', 'ZoneId', 'integer', $this);
  674. case 'Rate':
  675. return new QQNode('rate', 'Rate', 'double', $this);
  676. case '_PrimaryKeyNode':
  677. return new QQNode('id', 'Id', 'integer', $this);
  678. default:
  679. try {
  680. return parent::__get($strName);
  681. } catch (QCallerException $objExc) {
  682. $objExc->IncrementOffset();
  683. throw $objExc;
  684. }
  685. }
  686. }
  687. }
  688. ?>