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.

1364 lines
58 KiB

  1. <?php
  2. /**
  3. * The abstract ShippingMethodGen 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 ShippingMethod subclass which
  8. * extends this ShippingMethodGen 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 ShippingMethod class.
  15. *
  16. * @package Quinta CMS
  17. * @subpackage GeneratedDataObjects
  18. * @property-read integer $Id the value for intId (Read-Only PK)
  19. * @property string $Title the value for strTitle
  20. * @property string $Carrier the value for strCarrier
  21. * @property string $ServiceType the value for strServiceType
  22. * @property string $ClassName the value for strClassName
  23. * @property string $TransitTime the value for strTransitTime
  24. * @property string $Description the value for strDescription
  25. * @property string $ImageFilename the value for strImageFilename
  26. * @property boolean $Active the value for blnActive
  27. * @property boolean $IsInternational the value for blnIsInternational
  28. * @property boolean $TestMode the value for blnTestMode
  29. * @property integer $SortOrder the value for intSortOrder
  30. * @property-read Order $_Order the value for the private _objOrder (Read-Only) if set due to an expansion on the order.shipping_method_id reverse relationship
  31. * @property-read Order[] $_OrderArray the value for the private _objOrderArray (Read-Only) if set due to an ExpandAsArray on the order.shipping_method_id reverse relationship
  32. * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
  33. */
  34. class ShippingMethodGen extends QBaseClass
  35. {
  36. ///////////////////////////////////////////////////////////////////////
  37. // PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
  38. ///////////////////////////////////////////////////////////////////////
  39. /////////// Object properties ////////////
  40. /**
  41. * Protected member variable that maps to the database PK Identity column shipping_method.id
  42. * @var integer intId
  43. *
  44. */
  45. protected $intId = null;
  46. /**
  47. * Protected member variable that maps to the database column shipping_method.title
  48. * @var string strTitle
  49. *
  50. */
  51. protected $strTitle = null;
  52. const TitleMaxLength = 128;
  53. /**
  54. * Protected member variable that maps to the database column shipping_method.carrier
  55. * @var string strCarrier
  56. *
  57. */
  58. protected $strCarrier = null;
  59. const CarrierMaxLength = 128;
  60. /**
  61. * Protected member variable that maps to the database column shipping_method.service_type
  62. * @var string strServiceType
  63. *
  64. */
  65. protected $strServiceType = null;
  66. const ServiceTypeMaxLength = 128;
  67. /**
  68. * Protected member variable that maps to the database column shipping_method.class_name
  69. * @var string strClassName
  70. *
  71. */
  72. protected $strClassName = null;
  73. const ClassNameMaxLength = 128;
  74. /**
  75. * Protected member variable that maps to the database column shipping_method.transit_time
  76. * @var string strTransitTime
  77. *
  78. */
  79. protected $strTransitTime = null;
  80. const TransitTimeMaxLength = 16;
  81. /**
  82. * Protected member variable that maps to the database column shipping_method.description
  83. * @var string strDescription
  84. *
  85. */
  86. protected $strDescription = null;
  87. /**
  88. * Protected member variable that maps to the database column shipping_method.image_filename
  89. * @var string strImageFilename
  90. *
  91. */
  92. protected $strImageFilename = null;
  93. const ImageFilenameMaxLength = 128;
  94. /**
  95. * Protected member variable that maps to the database column shipping_method.active
  96. * @var boolean blnActive
  97. *
  98. */
  99. protected $blnActive = null;
  100. /**
  101. * Protected member variable that maps to the database column shipping_method.is_international
  102. * @var boolean blnIsInternational
  103. *
  104. */
  105. protected $blnIsInternational = null;
  106. /**
  107. * Protected member variable that maps to the database column shipping_method.test_mode
  108. * @var boolean blnTestMode
  109. *
  110. */
  111. protected $blnTestMode = null;
  112. /**
  113. * Protected member variable that maps to the database column shipping_method.sort_order
  114. * @var integer intSortOrder
  115. *
  116. */
  117. protected $intSortOrder = null;
  118. /**
  119. * Private member variable that stores a reference to a single Order object
  120. * (of type Order), if this ShippingMethod object was restored with
  121. * an expansion on the order association table.
  122. * @var Order _objOrder;
  123. */
  124. private $_objOrder;
  125. /**
  126. * Private member variable that stores a reference to an array of Order objects
  127. * (of type Order[]), if this ShippingMethod object was restored with
  128. * an ExpandAsArray on the order association table.
  129. * @var Order[] _objOrderArray;
  130. */
  131. private $_objOrderArray = array();
  132. /**
  133. * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
  134. * columns from the run-time database query result for this object). Used by InstantiateDbRow and
  135. * GetVirtualAttribute.
  136. * @var string[] $__strVirtualAttributeArray
  137. */
  138. protected $__strVirtualAttributeArray = array();
  139. /**
  140. * Protected internal member variable that specifies whether or not this object is Restored from the database.
  141. * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
  142. * @var bool __blnRestored;
  143. */
  144. protected $__blnRestored;
  145. ///////////////////////////////
  146. // PROTECTED MEMBER OBJECTS
  147. ///////////////////////////////
  148. ///////////////////////////////
  149. // CLASS-WIDE LOAD AND COUNT METHODS
  150. ///////////////////////////////
  151. /**
  152. * Static method to retrieve the Database object that owns this class.
  153. * @return QDatabaseBase reference to the Database object that can query this class
  154. */
  155. public static function GetDatabase() {
  156. return QApplication::$Database[1];
  157. }
  158. /**
  159. * Load a ShippingMethod from PK Info
  160. * @param integer $intId
  161. * @return ShippingMethod
  162. */
  163. public static function Load($intId) {
  164. // Use QuerySingle to Perform the Query
  165. return ShippingMethod::QuerySingle(
  166. QQ::Equal(QQN::ShippingMethod()->Id, $intId)
  167. );
  168. }
  169. /**
  170. * Load all ShippingMethods
  171. * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  172. * @return ShippingMethod[]
  173. */
  174. public static function LoadAll($objOptionalClauses = null) {
  175. // Call ShippingMethod::QueryArray to perform the LoadAll query
  176. try {
  177. return ShippingMethod::QueryArray(QQ::All(), $objOptionalClauses);
  178. } catch (QCallerException $objExc) {
  179. $objExc->IncrementOffset();
  180. throw $objExc;
  181. }
  182. }
  183. /**
  184. * Count all ShippingMethods
  185. * @return int
  186. */
  187. public static function CountAll() {
  188. // Call ShippingMethod::QueryCount to perform the CountAll query
  189. return ShippingMethod::QueryCount(QQ::All());
  190. }
  191. ///////////////////////////////
  192. // QCODO QUERY-RELATED METHODS
  193. ///////////////////////////////
  194. /**
  195. * Internally called method to assist with calling Qcodo Query for this class
  196. * on load methods.
  197. * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
  198. * @param QQCondition $objConditions any conditions on the query, itself
  199. * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
  200. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
  201. * @param boolean $blnCountOnly only select a rowcount
  202. * @return string the query statement
  203. */
  204. protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
  205. // Get the Database Object for this Class
  206. $objDatabase = ShippingMethod::GetDatabase();
  207. // Create/Build out the QueryBuilder object with ShippingMethod-specific SELET and FROM fields
  208. $objQueryBuilder = new QQueryBuilder($objDatabase, 'shipping_method');
  209. ShippingMethod::GetSelectFields($objQueryBuilder);
  210. $objQueryBuilder->AddFromItem('shipping_method');
  211. // Set "CountOnly" option (if applicable)
  212. if ($blnCountOnly)
  213. $objQueryBuilder->SetCountOnlyFlag();
  214. // Apply Any Conditions
  215. if ($objConditions)
  216. try {
  217. $objConditions->UpdateQueryBuilder($objQueryBuilder);
  218. } catch (QCallerException $objExc) {
  219. $objExc->IncrementOffset();
  220. throw $objExc;
  221. }
  222. // Iterate through all the Optional Clauses (if any) and perform accordingly
  223. if ($objOptionalClauses) {
  224. if ($objOptionalClauses instanceof QQClause)
  225. $objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
  226. else if (is_array($objOptionalClauses))
  227. foreach ($objOptionalClauses as $objClause)
  228. $objClause->UpdateQueryBuilder($objQueryBuilder);
  229. else
  230. throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
  231. }
  232. // Get the SQL Statement
  233. $strQuery = $objQueryBuilder->GetStatement();
  234. // Prepare the Statement with the Query Parameters (if applicable)
  235. if ($mixParameterArray) {
  236. if (is_array($mixParameterArray)) {
  237. if (count($mixParameterArray))
  238. $strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
  239. // Ensure that there are no other Unresolved Named Parameters
  240. if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
  241. throw new QCallerException('Unresolved named parameters in the query');
  242. } else
  243. throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
  244. }
  245. // Return the Objects
  246. return $strQuery;
  247. }
  248. /**
  249. * Static Qcodo Query method to query for a single ShippingMethod object.
  250. * Uses BuildQueryStatment to perform most of the work.
  251. * @param QQCondition $objConditions any conditions on the query, itself
  252. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  253. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  254. * @return ShippingMethod the queried object
  255. */
  256. public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  257. // Get the Query Statement
  258. try {
  259. $strQuery = ShippingMethod::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
  260. } catch (QCallerException $objExc) {
  261. $objExc->IncrementOffset();
  262. throw $objExc;
  263. }
  264. // Perform the Query, Get the First Row, and Instantiate a new ShippingMethod object
  265. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  266. return ShippingMethod::InstantiateDbRow($objDbResult->GetNextRow(), null, null, null, $objQueryBuilder->ColumnAliasArray);
  267. }
  268. /**
  269. * Static Qcodo Query method to query for an array of ShippingMethod objects.
  270. * Uses BuildQueryStatment to perform most of the work.
  271. * @param QQCondition $objConditions any conditions on the query, itself
  272. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  273. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  274. * @return ShippingMethod[] the queried objects as an array
  275. */
  276. public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  277. // Get the Query Statement
  278. try {
  279. $strQuery = ShippingMethod::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
  280. } catch (QCallerException $objExc) {
  281. $objExc->IncrementOffset();
  282. throw $objExc;
  283. }
  284. // Perform the Query and Instantiate the Array Result
  285. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  286. return ShippingMethod::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
  287. }
  288. /**
  289. * Static Qcodo Query method to query for a count of ShippingMethod objects.
  290. * Uses BuildQueryStatment to perform most of the work.
  291. * @param QQCondition $objConditions any conditions on the query, itself
  292. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  293. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  294. * @return integer the count of queried objects as an integer
  295. */
  296. public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  297. // Get the Query Statement
  298. try {
  299. $strQuery = ShippingMethod::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
  300. } catch (QCallerException $objExc) {
  301. $objExc->IncrementOffset();
  302. throw $objExc;
  303. }
  304. // Perform the Query and return the row_count
  305. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  306. // Figure out if the query is using GroupBy
  307. $blnGrouped = false;
  308. if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
  309. if ($objClause instanceof QQGroupBy) {
  310. $blnGrouped = true;
  311. break;
  312. }
  313. }
  314. if ($blnGrouped)
  315. // Groups in this query - return the count of Groups (which is the count of all rows)
  316. return $objDbResult->CountRows();
  317. else {
  318. // No Groups - return the sql-calculated count(*) value
  319. $strDbRow = $objDbResult->FetchRow();
  320. return QType::Cast($strDbRow[0], QType::Integer);
  321. }
  322. }
  323. /* public static function QueryArrayCached($strConditions, $mixParameterArray = null) {
  324. // Get the Database Object for this Class
  325. $objDatabase = ShippingMethod::GetDatabase();
  326. // Lookup the QCache for This Query Statement
  327. $objCache = new QCache('query', 'shipping_method_' . serialize($strConditions));
  328. if (!($strQuery = $objCache->GetData())) {
  329. // Not Found -- Go ahead and Create/Build out a new QueryBuilder object with ShippingMethod-specific fields
  330. $objQueryBuilder = new QQueryBuilder($objDatabase);
  331. ShippingMethod::GetSelectFields($objQueryBuilder);
  332. ShippingMethod::GetFromFields($objQueryBuilder);
  333. // Ensure the Passed-in Conditions is a string
  334. try {
  335. $strConditions = QType::Cast($strConditions, QType::String);
  336. } catch (QCallerException $objExc) {
  337. $objExc->IncrementOffset();
  338. throw $objExc;
  339. }
  340. // Create the Conditions object, and apply it
  341. $objConditions = eval('return ' . $strConditions . ';');
  342. // Apply Any Conditions
  343. if ($objConditions)
  344. $objConditions->UpdateQueryBuilder($objQueryBuilder);
  345. // Get the SQL Statement
  346. $strQuery = $objQueryBuilder->GetStatement();
  347. // Save the SQL Statement in the Cache
  348. $objCache->SaveData($strQuery);
  349. }
  350. // Prepare the Statement with the Parameters
  351. if ($mixParameterArray)
  352. $strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
  353. // Perform the Query and Instantiate the Array Result
  354. $objDbResult = $objDatabase->Query($strQuery);
  355. return ShippingMethod::InstantiateDbResult($objDbResult);
  356. }*/
  357. /**
  358. * Updates a QQueryBuilder with the SELECT fields for this ShippingMethod
  359. * @param QQueryBuilder $objBuilder the Query Builder object to update
  360. * @param string $strPrefix optional prefix to add to the SELECT fields
  361. */
  362. public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
  363. if ($strPrefix) {
  364. $strTableName = $strPrefix;
  365. $strAliasPrefix = $strPrefix . '__';
  366. } else {
  367. $strTableName = 'shipping_method';
  368. $strAliasPrefix = '';
  369. }
  370. $objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
  371. $objBuilder->AddSelectItem($strTableName, 'title', $strAliasPrefix . 'title');
  372. $objBuilder->AddSelectItem($strTableName, 'carrier', $strAliasPrefix . 'carrier');
  373. $objBuilder->AddSelectItem($strTableName, 'service_type', $strAliasPrefix . 'service_type');
  374. $objBuilder->AddSelectItem($strTableName, 'class_name', $strAliasPrefix . 'class_name');
  375. $objBuilder->AddSelectItem($strTableName, 'transit_time', $strAliasPrefix . 'transit_time');
  376. $objBuilder->AddSelectItem($strTableName, 'description', $strAliasPrefix . 'description');
  377. $objBuilder->AddSelectItem($strTableName, 'image_filename', $strAliasPrefix . 'image_filename');
  378. $objBuilder->AddSelectItem($strTableName, 'active', $strAliasPrefix . 'active');
  379. $objBuilder->AddSelectItem($strTableName, 'is_international', $strAliasPrefix . 'is_international');
  380. $objBuilder->AddSelectItem($strTableName, 'test_mode', $strAliasPrefix . 'test_mode');
  381. $objBuilder->AddSelectItem($strTableName, 'sort_order', $strAliasPrefix . 'sort_order');
  382. }
  383. ///////////////////////////////
  384. // INSTANTIATION-RELATED METHODS
  385. ///////////////////////////////
  386. /**
  387. * Instantiate a ShippingMethod from a Database Row.
  388. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  389. * is calling this ShippingMethod::InstantiateDbRow in order to perform
  390. * early binding on referenced objects.
  391. * @param DatabaseRowBase $objDbRow
  392. * @param string $strAliasPrefix
  393. * @param string $strExpandAsArrayNodes
  394. * @param QBaseClass $objPreviousItem
  395. * @param string[] $strColumnAliasArray
  396. * @return ShippingMethod
  397. */
  398. public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) {
  399. // If blank row, return null
  400. if (!$objDbRow)
  401. return null;
  402. // See if we're doing an array expansion on the previous item
  403. $strAlias = $strAliasPrefix . 'id';
  404. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  405. if (($strExpandAsArrayNodes) && ($objPreviousItem) &&
  406. ($objPreviousItem->intId == $objDbRow->GetColumn($strAliasName, 'Integer'))) {
  407. // We are. Now, prepare to check for ExpandAsArray clauses
  408. $blnExpandedViaArray = false;
  409. if (!$strAliasPrefix)
  410. $strAliasPrefix = 'shipping_method__';
  411. $strAlias = $strAliasPrefix . 'order__id';
  412. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  413. if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
  414. (!is_null($objDbRow->GetColumn($strAliasName)))) {
  415. if ($intPreviousChildItemCount = count($objPreviousItem->_objOrderArray)) {
  416. $objPreviousChildItem = $objPreviousItem->_objOrderArray[$intPreviousChildItemCount - 1];
  417. $objChildItem = Order::InstantiateDbRow($objDbRow, $strAliasPrefix . 'order__', $strExpandAsArrayNodes, $objPreviousChildItem, $strColumnAliasArray);
  418. if ($objChildItem)
  419. $objPreviousItem->_objOrderArray[] = $objChildItem;
  420. } else
  421. $objPreviousItem->_objOrderArray[] = Order::InstantiateDbRow($objDbRow, $strAliasPrefix . 'order__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  422. $blnExpandedViaArray = true;
  423. }
  424. // Either return false to signal array expansion, or check-to-reset the Alias prefix and move on
  425. if ($blnExpandedViaArray)
  426. return false;
  427. else if ($strAliasPrefix == 'shipping_method__')
  428. $strAliasPrefix = null;
  429. }
  430. // Create a new instance of the ShippingMethod object
  431. $objToReturn = new ShippingMethod();
  432. $objToReturn->__blnRestored = true;
  433. $strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
  434. $objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
  435. $strAliasName = array_key_exists($strAliasPrefix . 'title', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'title'] : $strAliasPrefix . 'title';
  436. $objToReturn->strTitle = $objDbRow->GetColumn($strAliasName, 'VarChar');
  437. $strAliasName = array_key_exists($strAliasPrefix . 'carrier', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'carrier'] : $strAliasPrefix . 'carrier';
  438. $objToReturn->strCarrier = $objDbRow->GetColumn($strAliasName, 'VarChar');
  439. $strAliasName = array_key_exists($strAliasPrefix . 'service_type', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'service_type'] : $strAliasPrefix . 'service_type';
  440. $objToReturn->strServiceType = $objDbRow->GetColumn($strAliasName, 'VarChar');
  441. $strAliasName = array_key_exists($strAliasPrefix . 'class_name', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'class_name'] : $strAliasPrefix . 'class_name';
  442. $objToReturn->strClassName = $objDbRow->GetColumn($strAliasName, 'VarChar');
  443. $strAliasName = array_key_exists($strAliasPrefix . 'transit_time', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'transit_time'] : $strAliasPrefix . 'transit_time';
  444. $objToReturn->strTransitTime = $objDbRow->GetColumn($strAliasName, 'VarChar');
  445. $strAliasName = array_key_exists($strAliasPrefix . 'description', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'description'] : $strAliasPrefix . 'description';
  446. $objToReturn->strDescription = $objDbRow->GetColumn($strAliasName, 'Blob');
  447. $strAliasName = array_key_exists($strAliasPrefix . 'image_filename', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'image_filename'] : $strAliasPrefix . 'image_filename';
  448. $objToReturn->strImageFilename = $objDbRow->GetColumn($strAliasName, 'VarChar');
  449. $strAliasName = array_key_exists($strAliasPrefix . 'active', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'active'] : $strAliasPrefix . 'active';
  450. $objToReturn->blnActive = $objDbRow->GetColumn($strAliasName, 'Bit');
  451. $strAliasName = array_key_exists($strAliasPrefix . 'is_international', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'is_international'] : $strAliasPrefix . 'is_international';
  452. $objToReturn->blnIsInternational = $objDbRow->GetColumn($strAliasName, 'Bit');
  453. $strAliasName = array_key_exists($strAliasPrefix . 'test_mode', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'test_mode'] : $strAliasPrefix . 'test_mode';
  454. $objToReturn->blnTestMode = $objDbRow->GetColumn($strAliasName, 'Bit');
  455. $strAliasName = array_key_exists($strAliasPrefix . 'sort_order', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'sort_order'] : $strAliasPrefix . 'sort_order';
  456. $objToReturn->intSortOrder = $objDbRow->GetColumn($strAliasName, 'Integer');
  457. // Instantiate Virtual Attributes
  458. foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
  459. $strVirtualPrefix = $strAliasPrefix . '__';
  460. $strVirtualPrefixLength = strlen($strVirtualPrefix);
  461. if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
  462. $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
  463. }
  464. // Prepare to Check for Early/Virtual Binding
  465. if (!$strAliasPrefix)
  466. $strAliasPrefix = 'shipping_method__';
  467. // Check for Order Virtual Binding
  468. $strAlias = $strAliasPrefix . 'order__id';
  469. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  470. if (!is_null($objDbRow->GetColumn($strAliasName))) {
  471. if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
  472. $objToReturn->_objOrderArray[] = Order::InstantiateDbRow($objDbRow, $strAliasPrefix . 'order__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  473. else
  474. $objToReturn->_objOrder = Order::InstantiateDbRow($objDbRow, $strAliasPrefix . 'order__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  475. }
  476. return $objToReturn;
  477. }
  478. /**
  479. * Instantiate an array of ShippingMethods from a Database Result
  480. * @param DatabaseResultBase $objDbResult
  481. * @param string $strExpandAsArrayNodes
  482. * @param string[] $strColumnAliasArray
  483. * @return ShippingMethod[]
  484. */
  485. public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
  486. $objToReturn = array();
  487. if (!$strColumnAliasArray)
  488. $strColumnAliasArray = array();
  489. // If blank resultset, then return empty array
  490. if (!$objDbResult)
  491. return $objToReturn;
  492. // Load up the return array with each row
  493. if ($strExpandAsArrayNodes) {
  494. $objLastRowItem = null;
  495. while ($objDbRow = $objDbResult->GetNextRow()) {
  496. $objItem = ShippingMethod::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objLastRowItem, $strColumnAliasArray);
  497. if ($objItem) {
  498. $objToReturn[] = $objItem;
  499. $objLastRowItem = $objItem;
  500. }
  501. }
  502. } else {
  503. while ($objDbRow = $objDbResult->GetNextRow())
  504. $objToReturn[] = ShippingMethod::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
  505. }
  506. return $objToReturn;
  507. }
  508. ///////////////////////////////////////////////////
  509. // INDEX-BASED LOAD METHODS (Single Load and Array)
  510. ///////////////////////////////////////////////////
  511. /**
  512. * Load a single ShippingMethod object,
  513. * by Id Index(es)
  514. * @param integer $intId
  515. * @return ShippingMethod
  516. */
  517. public static function LoadById($intId) {
  518. return ShippingMethod::QuerySingle(
  519. QQ::Equal(QQN::ShippingMethod()->Id, $intId)
  520. );
  521. }
  522. ////////////////////////////////////////////////////
  523. // INDEX-BASED LOAD METHODS (Array via Many to Many)
  524. ////////////////////////////////////////////////////
  525. //////////////////////////
  526. // SAVE, DELETE AND RELOAD
  527. //////////////////////////
  528. /**
  529. * Save this ShippingMethod
  530. * @param bool $blnForceInsert
  531. * @param bool $blnForceUpdate
  532. * @return int
  533. */
  534. public function Save($blnForceInsert = false, $blnForceUpdate = false) {
  535. // Get the Database Object for this Class
  536. $objDatabase = ShippingMethod::GetDatabase();
  537. $mixToReturn = null;
  538. try {
  539. if ((!$this->__blnRestored) || ($blnForceInsert)) {
  540. // Perform an INSERT query
  541. $objDatabase->NonQuery('
  542. INSERT INTO `shipping_method` (
  543. `title`,
  544. `carrier`,
  545. `service_type`,
  546. `class_name`,
  547. `transit_time`,
  548. `description`,
  549. `image_filename`,
  550. `active`,
  551. `is_international`,
  552. `test_mode`,
  553. `sort_order`
  554. ) VALUES (
  555. ' . $objDatabase->SqlVariable($this->strTitle) . ',
  556. ' . $objDatabase->SqlVariable($this->strCarrier) . ',
  557. ' . $objDatabase->SqlVariable($this->strServiceType) . ',
  558. ' . $objDatabase->SqlVariable($this->strClassName) . ',
  559. ' . $objDatabase->SqlVariable($this->strTransitTime) . ',
  560. ' . $objDatabase->SqlVariable($this->strDescription) . ',
  561. ' . $objDatabase->SqlVariable($this->strImageFilename) . ',
  562. ' . $objDatabase->SqlVariable($this->blnActive) . ',
  563. ' . $objDatabase->SqlVariable($this->blnIsInternational) . ',
  564. ' . $objDatabase->SqlVariable($this->blnTestMode) . ',
  565. ' . $objDatabase->SqlVariable($this->intSortOrder) . '
  566. )
  567. ');
  568. // Update Identity column and return its value
  569. $mixToReturn = $this->intId = $objDatabase->InsertId('shipping_method', 'id');
  570. } else {
  571. // Perform an UPDATE query
  572. // First checking for Optimistic Locking constraints (if applicable)
  573. // Perform the UPDATE query
  574. $objDatabase->NonQuery('
  575. UPDATE
  576. `shipping_method`
  577. SET
  578. `title` = ' . $objDatabase->SqlVariable($this->strTitle) . ',
  579. `carrier` = ' . $objDatabase->SqlVariable($this->strCarrier) . ',
  580. `service_type` = ' . $objDatabase->SqlVariable($this->strServiceType) . ',
  581. `class_name` = ' . $objDatabase->SqlVariable($this->strClassName) . ',
  582. `transit_time` = ' . $objDatabase->SqlVariable($this->strTransitTime) . ',
  583. `description` = ' . $objDatabase->SqlVariable($this->strDescription) . ',
  584. `image_filename` = ' . $objDatabase->SqlVariable($this->strImageFilename) . ',
  585. `active` = ' . $objDatabase->SqlVariable($this->blnActive) . ',
  586. `is_international` = ' . $objDatabase->SqlVariable($this->blnIsInternational) . ',
  587. `test_mode` = ' . $objDatabase->SqlVariable($this->blnTestMode) . ',
  588. `sort_order` = ' . $objDatabase->SqlVariable($this->intSortOrder) . '
  589. WHERE
  590. `id` = ' . $objDatabase->SqlVariable($this->intId) . '
  591. ');
  592. }
  593. } catch (QCallerException $objExc) {
  594. $objExc->IncrementOffset();
  595. throw $objExc;
  596. }
  597. // Update __blnRestored and any Non-Identity PK Columns (if applicable)
  598. $this->__blnRestored = true;
  599. // Return
  600. return $mixToReturn;
  601. }
  602. /**
  603. * Delete this ShippingMethod
  604. * @return void
  605. */
  606. public function Delete() {
  607. if ((is_null($this->intId)))
  608. throw new QUndefinedPrimaryKeyException('Cannot delete this ShippingMethod with an unset primary key.');
  609. // Get the Database Object for this Class
  610. $objDatabase = ShippingMethod::GetDatabase();
  611. // Perform the SQL Query
  612. $objDatabase->NonQuery('
  613. DELETE FROM
  614. `shipping_method`
  615. WHERE
  616. `id` = ' . $objDatabase->SqlVariable($this->intId) . '');
  617. }
  618. /**
  619. * Delete all ShippingMethods
  620. * @return void
  621. */
  622. public static function DeleteAll() {
  623. // Get the Database Object for this Class
  624. $objDatabase = ShippingMethod::GetDatabase();
  625. // Perform the Query
  626. $objDatabase->NonQuery('
  627. DELETE FROM
  628. `shipping_method`');
  629. }
  630. /**
  631. * Truncate shipping_method table
  632. * @return void
  633. */
  634. public static function Truncate() {
  635. // Get the Database Object for this Class
  636. $objDatabase = ShippingMethod::GetDatabase();
  637. // Perform the Query
  638. $objDatabase->NonQuery('
  639. TRUNCATE `shipping_method`');
  640. }
  641. /**
  642. * Reload this ShippingMethod from the database.
  643. * @return void
  644. */
  645. public function Reload() {
  646. // Make sure we are actually Restored from the database
  647. if (!$this->__blnRestored)
  648. throw new QCallerException('Cannot call Reload() on a new, unsaved ShippingMethod object.');
  649. // Reload the Object
  650. $objReloaded = ShippingMethod::Load($this->intId);
  651. // Update $this's local variables to match
  652. $this->strTitle = $objReloaded->strTitle;
  653. $this->strCarrier = $objReloaded->strCarrier;
  654. $this->strServiceType = $objReloaded->strServiceType;
  655. $this->strClassName = $objReloaded->strClassName;
  656. $this->strTransitTime = $objReloaded->strTransitTime;
  657. $this->strDescription = $objReloaded->strDescription;
  658. $this->strImageFilename = $objReloaded->strImageFilename;
  659. $this->blnActive = $objReloaded->blnActive;
  660. $this->blnIsInternational = $objReloaded->blnIsInternational;
  661. $this->blnTestMode = $objReloaded->blnTestMode;
  662. $this->intSortOrder = $objReloaded->intSortOrder;
  663. }
  664. ////////////////////
  665. // GETTORS AND SETTORS
  666. ////////////////////
  667. /**
  668. * Lookup a VirtualAttribute value (if applicable). Returns NULL if none found.
  669. * @param string $strName
  670. * @return string
  671. */
  672. public function GetVirtualAttribute($strName)
  673. {
  674. if (array_key_exists($strName, $this->__strVirtualAttributeArray))
  675. return $this->__strVirtualAttributeArray[$strName];
  676. return null;
  677. }
  678. /**
  679. * Override method to perform a property "Get"
  680. * This will get the value of $strName
  681. *
  682. * @param string $strName Name of the property to get
  683. * @return mixed
  684. */
  685. public function __get($strName)
  686. {
  687. switch ($strName)
  688. {
  689. ///////////////////
  690. // Member Variables
  691. ///////////////////
  692. case 'Id':
  693. /**
  694. * Gets the value for intId (Read-Only PK)
  695. * @return integer
  696. */
  697. return $this->intId;
  698. case 'Title':
  699. /**
  700. * Gets the value for strTitle
  701. * @return string
  702. */
  703. return $this->strTitle;
  704. case 'Carrier':
  705. /**
  706. * Gets the value for strCarrier
  707. * @return string
  708. */
  709. return $this->strCarrier;
  710. case 'ServiceType':
  711. /**
  712. * Gets the value for strServiceType
  713. * @return string
  714. */
  715. return $this->strServiceType;
  716. case 'ClassName':
  717. /**
  718. * Gets the value for strClassName
  719. * @return string
  720. */
  721. return $this->strClassName;
  722. case 'TransitTime':
  723. /**
  724. * Gets the value for strTransitTime
  725. * @return string
  726. */
  727. return $this->strTransitTime;
  728. case 'Description':
  729. /**
  730. * Gets the value for strDescription
  731. * @return string
  732. */
  733. return $this->strDescription;
  734. case 'ImageFilename':
  735. /**
  736. * Gets the value for strImageFilename
  737. * @return string
  738. */
  739. return $this->strImageFilename;
  740. case 'Active':
  741. /**
  742. * Gets the value for blnActive
  743. * @return boolean
  744. */
  745. return $this->blnActive;
  746. case 'IsInternational':
  747. /**
  748. * Gets the value for blnIsInternational
  749. * @return boolean
  750. */
  751. return $this->blnIsInternational;
  752. case 'TestMode':
  753. /**
  754. * Gets the value for blnTestMode
  755. * @return boolean
  756. */
  757. return $this->blnTestMode;
  758. case 'SortOrder':
  759. /**
  760. * Gets the value for intSortOrder
  761. * @return integer
  762. */
  763. return $this->intSortOrder;
  764. ///////////////////
  765. // Member Objects
  766. ///////////////////
  767. ////////////////////////////
  768. // Virtual Object References (Many to Many and Reverse References)
  769. // (If restored via a "Many-to" expansion)
  770. ////////////////////////////
  771. case '_Order':
  772. /**
  773. * Gets the value for the private _objOrder (Read-Only)
  774. * if set due to an expansion on the order.shipping_method_id reverse relationship
  775. * @return Order
  776. */
  777. return $this->_objOrder;
  778. case '_OrderArray':
  779. /**
  780. * Gets the value for the private _objOrderArray (Read-Only)
  781. * if set due to an ExpandAsArray on the order.shipping_method_id reverse relationship
  782. * @return Order[]
  783. */
  784. return (array) $this->_objOrderArray;
  785. case '__Restored':
  786. return $this->__blnRestored;
  787. default:
  788. try {
  789. return parent::__get($strName);
  790. } catch (QCallerException $objExc) {
  791. $objExc->IncrementOffset();
  792. throw $objExc;
  793. }
  794. }
  795. }
  796. /**
  797. * Override method to perform a property "Set"
  798. * This will set the property $strName to be $mixValue
  799. *
  800. * @param string $strName Name of the property to set
  801. * @param string $mixValue New value of the property
  802. * @return mixed
  803. */
  804. public function __set($strName, $mixValue) {
  805. switch ($strName) {
  806. ///////////////////
  807. // Member Variables
  808. ///////////////////
  809. case 'Title':
  810. /**
  811. * Sets the value for strTitle
  812. * @param string $mixValue
  813. * @return string
  814. */
  815. try {
  816. return ($this->strTitle = QType::Cast($mixValue, QType::String));
  817. } catch (QCallerException $objExc) {
  818. $objExc->IncrementOffset();
  819. throw $objExc;
  820. }
  821. case 'Carrier':
  822. /**
  823. * Sets the value for strCarrier
  824. * @param string $mixValue
  825. * @return string
  826. */
  827. try {
  828. return ($this->strCarrier = QType::Cast($mixValue, QType::String));
  829. } catch (QCallerException $objExc) {
  830. $objExc->IncrementOffset();
  831. throw $objExc;
  832. }
  833. case 'ServiceType':
  834. /**
  835. * Sets the value for strServiceType
  836. * @param string $mixValue
  837. * @return string
  838. */
  839. try {
  840. return ($this->strServiceType = QType::Cast($mixValue, QType::String));
  841. } catch (QCallerException $objExc) {
  842. $objExc->IncrementOffset();
  843. throw $objExc;
  844. }
  845. case 'ClassName':
  846. /**
  847. * Sets the value for strClassName
  848. * @param string $mixValue
  849. * @return string
  850. */
  851. try {
  852. return ($this->strClassName = QType::Cast($mixValue, QType::String));
  853. } catch (QCallerException $objExc) {
  854. $objExc->IncrementOffset();
  855. throw $objExc;
  856. }
  857. case 'TransitTime':
  858. /**
  859. * Sets the value for strTransitTime
  860. * @param string $mixValue
  861. * @return string
  862. */
  863. try {
  864. return ($this->strTransitTime = QType::Cast($mixValue, QType::String));
  865. } catch (QCallerException $objExc) {
  866. $objExc->IncrementOffset();
  867. throw $objExc;
  868. }
  869. case 'Description':
  870. /**
  871. * Sets the value for strDescription
  872. * @param string $mixValue
  873. * @return string
  874. */
  875. try {
  876. return ($this->strDescription = QType::Cast($mixValue, QType::String));
  877. } catch (QCallerException $objExc) {
  878. $objExc->IncrementOffset();
  879. throw $objExc;
  880. }
  881. case 'ImageFilename':
  882. /**
  883. * Sets the value for strImageFilename
  884. * @param string $mixValue
  885. * @return string
  886. */
  887. try {
  888. return ($this->strImageFilename = QType::Cast($mixValue, QType::String));
  889. } catch (QCallerException $objExc) {
  890. $objExc->IncrementOffset();
  891. throw $objExc;
  892. }
  893. case 'Active':
  894. /**
  895. * Sets the value for blnActive
  896. * @param boolean $mixValue
  897. * @return boolean
  898. */
  899. try {
  900. return ($this->blnActive = QType::Cast($mixValue, QType::Boolean));
  901. } catch (QCallerException $objExc) {
  902. $objExc->IncrementOffset();
  903. throw $objExc;
  904. }
  905. case 'IsInternational':
  906. /**
  907. * Sets the value for blnIsInternational
  908. * @param boolean $mixValue
  909. * @return boolean
  910. */
  911. try {
  912. return ($this->blnIsInternational = QType::Cast($mixValue, QType::Boolean));
  913. } catch (QCallerException $objExc) {
  914. $objExc->IncrementOffset();
  915. throw $objExc;
  916. }
  917. case 'TestMode':
  918. /**
  919. * Sets the value for blnTestMode
  920. * @param boolean $mixValue
  921. * @return boolean
  922. */
  923. try {
  924. return ($this->blnTestMode = QType::Cast($mixValue, QType::Boolean));
  925. } catch (QCallerException $objExc) {
  926. $objExc->IncrementOffset();
  927. throw $objExc;
  928. }
  929. case 'SortOrder':
  930. /**
  931. * Sets the value for intSortOrder
  932. * @param integer $mixValue
  933. * @return integer
  934. */
  935. try {
  936. return ($this->intSortOrder = QType::Cast($mixValue, QType::Integer));
  937. } catch (QCallerException $objExc) {
  938. $objExc->IncrementOffset();
  939. throw $objExc;
  940. }
  941. ///////////////////
  942. // Member Objects
  943. ///////////////////
  944. default:
  945. try {
  946. return parent::__set($strName, $mixValue);
  947. } catch (QCallerException $objExc) {
  948. $objExc->IncrementOffset();
  949. throw $objExc;
  950. }
  951. }
  952. }
  953. ///////////////////////////////
  954. // ASSOCIATED OBJECTS' METHODS
  955. ///////////////////////////////
  956. // Related Objects' Methods for Order
  957. //-------------------------------------------------------------------
  958. /**
  959. * Gets all associated Orders as an array of Order objects
  960. * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  961. * @return Order[]
  962. */
  963. public function GetOrderArray($objOptionalClauses = null) {
  964. if ((is_null($this->intId)))
  965. return array();
  966. try {
  967. return Order::LoadArrayByShippingMethodId($this->intId, $objOptionalClauses);
  968. } catch (QCallerException $objExc) {
  969. $objExc->IncrementOffset();
  970. throw $objExc;
  971. }
  972. }
  973. /**
  974. * Counts all associated Orders
  975. * @return int
  976. */
  977. public function CountOrders() {
  978. if ((is_null($this->intId)))
  979. return 0;
  980. return Order::CountByShippingMethodId($this->intId);
  981. }
  982. /**
  983. * Associates a Order
  984. * @param Order $objOrder
  985. * @return void
  986. */
  987. public function AssociateOrder(Order $objOrder) {
  988. if ((is_null($this->intId)))
  989. throw new QUndefinedPrimaryKeyException('Unable to call AssociateOrder on this unsaved ShippingMethod.');
  990. if ((is_null($objOrder->Id)))
  991. throw new QUndefinedPrimaryKeyException('Unable to call AssociateOrder on this ShippingMethod with an unsaved Order.');
  992. // Get the Database Object for this Class
  993. $objDatabase = ShippingMethod::GetDatabase();
  994. // Perform the SQL Query
  995. $objDatabase->NonQuery('
  996. UPDATE
  997. `order`
  998. SET
  999. `shipping_method_id` = ' . $objDatabase->SqlVariable($this->intId) . '
  1000. WHERE
  1001. `id` = ' . $objDatabase->SqlVariable($objOrder->Id) . '
  1002. ');
  1003. }
  1004. /**
  1005. * Unassociates a Order
  1006. * @param Order $objOrder
  1007. * @return void
  1008. */
  1009. public function UnassociateOrder(Order $objOrder) {
  1010. if ((is_null($this->intId)))
  1011. throw new QUndefinedPrimaryKeyException('Unable to call UnassociateOrder on this unsaved ShippingMethod.');
  1012. if ((is_null($objOrder->Id)))
  1013. throw new QUndefinedPrimaryKeyException('Unable to call UnassociateOrder on this ShippingMethod with an unsaved Order.');
  1014. // Get the Database Object for this Class
  1015. $objDatabase = ShippingMethod::GetDatabase();
  1016. // Perform the SQL Query
  1017. $objDatabase->NonQuery('
  1018. UPDATE
  1019. `order`
  1020. SET
  1021. `shipping_method_id` = null
  1022. WHERE
  1023. `id` = ' . $objDatabase->SqlVariable($objOrder->Id) . ' AND
  1024. `shipping_method_id` = ' . $objDatabase->SqlVariable($this->intId) . '
  1025. ');
  1026. }
  1027. /**
  1028. * Unassociates all Orders
  1029. * @return void
  1030. */
  1031. public function UnassociateAllOrders() {
  1032. if ((is_null($this->intId)))
  1033. throw new QUndefinedPrimaryKeyException('Unable to call UnassociateOrder on this unsaved ShippingMethod.');
  1034. // Get the Database Object for this Class
  1035. $objDatabase = ShippingMethod::GetDatabase();
  1036. // Perform the SQL Query
  1037. $objDatabase->NonQuery('
  1038. UPDATE
  1039. `order`
  1040. SET
  1041. `shipping_method_id` = null
  1042. WHERE
  1043. `shipping_method_id` = ' . $objDatabase->SqlVariable($this->intId) . '
  1044. ');
  1045. }
  1046. /**
  1047. * Deletes an associated Order
  1048. * @param Order $objOrder
  1049. * @return void
  1050. */
  1051. public function DeleteAssociatedOrder(Order $objOrder) {
  1052. if ((is_null($this->intId)))
  1053. throw new QUndefinedPrimaryKeyException('Unable to call UnassociateOrder on this unsaved ShippingMethod.');
  1054. if ((is_null($objOrder->Id)))
  1055. throw new QUndefinedPrimaryKeyException('Unable to call UnassociateOrder on this ShippingMethod with an unsaved Order.');
  1056. // Get the Database Object for this Class
  1057. $objDatabase = ShippingMethod::GetDatabase();
  1058. // Perform the SQL Query
  1059. $objDatabase->NonQuery('
  1060. DELETE FROM
  1061. `order`
  1062. WHERE
  1063. `id` = ' . $objDatabase->SqlVariable($objOrder->Id) . ' AND
  1064. `shipping_method_id` = ' . $objDatabase->SqlVariable($this->intId) . '
  1065. ');
  1066. }
  1067. /**
  1068. * Deletes all associated Orders
  1069. * @return void
  1070. */
  1071. public function DeleteAllOrders() {
  1072. if ((is_null($this->intId)))
  1073. throw new QUndefinedPrimaryKeyException('Unable to call UnassociateOrder on this unsaved ShippingMethod.');
  1074. // Get the Database Object for this Class
  1075. $objDatabase = ShippingMethod::GetDatabase();
  1076. // Perform the SQL Query
  1077. $objDatabase->NonQuery('
  1078. DELETE FROM
  1079. `order`
  1080. WHERE
  1081. `shipping_method_id` = ' . $objDatabase->SqlVariable($this->intId) . '
  1082. ');
  1083. }
  1084. }
  1085. /////////////////////////////////////
  1086. // ADDITIONAL CLASSES for QCODO QUERY
  1087. /////////////////////////////////////
  1088. class QQNodeShippingMethod extends QQNode {
  1089. protected $strTableName = 'shipping_method';
  1090. protected $strPrimaryKey = 'id';
  1091. protected $strClassName = 'ShippingMethod';
  1092. public function __get($strName) {
  1093. switch ($strName) {
  1094. case 'Id':
  1095. return new QQNode('id', 'Id', 'integer', $this);
  1096. case 'Title':
  1097. return new QQNode('title', 'Title', 'string', $this);
  1098. case 'Carrier':
  1099. return new QQNode('carrier', 'Carrier', 'string', $this);
  1100. case 'ServiceType':
  1101. return new QQNode('service_type', 'ServiceType', 'string', $this);
  1102. case 'ClassName':
  1103. return new QQNode('class_name', 'ClassName', 'string', $this);
  1104. case 'TransitTime':
  1105. return new QQNode('transit_time', 'TransitTime', 'string', $this);
  1106. case 'Description':
  1107. return new QQNode('description', 'Description', 'string', $this);
  1108. case 'ImageFilename':
  1109. return new QQNode('image_filename', 'ImageFilename', 'string', $this);
  1110. case 'Active':
  1111. return new QQNode('active', 'Active', 'boolean', $this);
  1112. case 'IsInternational':
  1113. return new QQNode('is_international', 'IsInternational', 'boolean', $this);
  1114. case 'TestMode':
  1115. return new QQNode('test_mode', 'TestMode', 'boolean', $this);
  1116. case 'SortOrder':
  1117. return new QQNode('sort_order', 'SortOrder', 'integer', $this);
  1118. case 'Order':
  1119. return new QQReverseReferenceNodeOrder($this, 'order', 'reverse_reference', 'shipping_method_id');
  1120. case '_PrimaryKeyNode':
  1121. return new QQNode('id', 'Id', 'integer', $this);
  1122. default:
  1123. try {
  1124. return parent::__get($strName);
  1125. } catch (QCallerException $objExc) {
  1126. $objExc->IncrementOffset();
  1127. throw $objExc;
  1128. }
  1129. }
  1130. }
  1131. }
  1132. class QQReverseReferenceNodeShippingMethod extends QQReverseReferenceNode {
  1133. protected $strTableName = 'shipping_method';
  1134. protected $strPrimaryKey = 'id';
  1135. protected $strClassName = 'ShippingMethod';
  1136. public function __get($strName) {
  1137. switch ($strName) {
  1138. case 'Id':
  1139. return new QQNode('id', 'Id', 'integer', $this);
  1140. case 'Title':
  1141. return new QQNode('title', 'Title', 'string', $this);
  1142. case 'Carrier':
  1143. return new QQNode('carrier', 'Carrier', 'string', $this);
  1144. case 'ServiceType':
  1145. return new QQNode('service_type', 'ServiceType', 'string', $this);
  1146. case 'ClassName':
  1147. return new QQNode('class_name', 'ClassName', 'string', $this);
  1148. case 'TransitTime':
  1149. return new QQNode('transit_time', 'TransitTime', 'string', $this);
  1150. case 'Description':
  1151. return new QQNode('description', 'Description', 'string', $this);
  1152. case 'ImageFilename':
  1153. return new QQNode('image_filename', 'ImageFilename', 'string', $this);
  1154. case 'Active':
  1155. return new QQNode('active', 'Active', 'boolean', $this);
  1156. case 'IsInternational':
  1157. return new QQNode('is_international', 'IsInternational', 'boolean', $this);
  1158. case 'TestMode':
  1159. return new QQNode('test_mode', 'TestMode', 'boolean', $this);
  1160. case 'SortOrder':
  1161. return new QQNode('sort_order', 'SortOrder', 'integer', $this);
  1162. case 'Order':
  1163. return new QQReverseReferenceNodeOrder($this, 'order', 'reverse_reference', 'shipping_method_id');
  1164. case '_PrimaryKeyNode':
  1165. return new QQNode('id', 'Id', 'integer', $this);
  1166. default:
  1167. try {
  1168. return parent::__get($strName);
  1169. } catch (QCallerException $objExc) {
  1170. $objExc->IncrementOffset();
  1171. throw $objExc;
  1172. }
  1173. }
  1174. }
  1175. }
  1176. ?>