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.

1461 lines
63 KiB

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