A Qcodo based CMS/ecommerce framework
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.

144 lines
4.8 KiB

12 years ago
  1. <?php
  2. require(__DATAGEN_CLASSES__ . '/PaypalTransactionGen.class.php');
  3. /**
  4. * The PaypalTransaction class defined here contains any
  5. * customized code for the PaypalTransaction class in the
  6. * Object Relational Model. It represents the "paypal_transaction" table
  7. * in the database, and extends from the code generated abstract PaypalTransactionGen
  8. * class, which contains all the basic CRUD-type functionality as well as
  9. * basic methods to handle relationships and index-based loading.
  10. *
  11. * @package Quasi
  12. * @subpackage ORM
  13. *
  14. */
  15. class PaypalTransaction extends PaypalTransactionGen {
  16. /**
  17. * Default "to string" handler
  18. * Allows pages to _p()/echo()/print() this object, and to define the default
  19. * way this object would be outputted.
  20. *
  21. * Can also be called directly via $objPaypalTransaction->__toString().
  22. *
  23. * @return string a nicely formatted string representation of this object
  24. */
  25. public function __toString() {
  26. return sprintf('Transaction #%s', $this->intId);
  27. }
  28. // protected $strSomeNewProperty;
  29. public function __get($strName)
  30. {
  31. switch ($strName)
  32. {
  33. case 'TimeStamp':
  34. return $this->dttTimeStamp;
  35. default:
  36. try {
  37. return parent::__get($strName);
  38. } catch (QCallerException $objExc) {
  39. $objExc->IncrementOffset();
  40. throw $objExc;
  41. }
  42. }
  43. }
  44. public function __set($strName, $mixValue)
  45. {
  46. switch ($strName)
  47. {
  48. case 'TimeStamp':
  49. if(is_string($mixValue))
  50. try {
  51. return($this->dttTimeStamp = new QDateTime($mixValue));
  52. } catch (QCallerException $objExc) {
  53. $objExc->IncrementOffset();
  54. throw $objExc;
  55. }
  56. else
  57. try {
  58. return ($this->dttTimeStamp = QType::Cast($mixValue, QType::DateTime));
  59. } catch (QInvalidCastException $objExc) {
  60. $objExc->IncrementOffset();
  61. throw $objExc;
  62. }
  63. default:
  64. try {
  65. return (parent::__set($strName, $mixValue));
  66. } catch (QCallerException $objExc) {
  67. $objExc->IncrementOffset();
  68. throw $objExc;
  69. }
  70. }
  71. }
  72. // Override or Create New Load/Count methods
  73. // (For obvious reasons, these methods are commented out...
  74. // but feel free to use these as a starting point)
  75. /*
  76. public static function LoadArrayBySample($strParam1, $intParam2, $objOptionalClauses = null) {
  77. // This will return an array of PaypalTransaction objects
  78. return PaypalTransaction::QueryArray(
  79. QQ::AndCondition(
  80. QQ::Equal(QQN::PaypalTransaction()->Param1, $strParam1),
  81. QQ::GreaterThan(QQN::PaypalTransaction()->Param2, $intParam2)
  82. ),
  83. $objOptionalClauses
  84. );
  85. }
  86. public static function LoadBySample($strParam1, $intParam2, $objOptionalClauses = null) {
  87. // This will return a single PaypalTransaction object
  88. return PaypalTransaction::QuerySingle(
  89. QQ::AndCondition(
  90. QQ::Equal(QQN::PaypalTransaction()->Param1, $strParam1),
  91. QQ::GreaterThan(QQN::PaypalTransaction()->Param2, $intParam2)
  92. ),
  93. $objOptionalClauses
  94. );
  95. }
  96. public static function CountBySample($strParam1, $intParam2, $objOptionalClauses = null) {
  97. // This will return a count of PaypalTransaction objects
  98. return PaypalTransaction::QueryCount(
  99. QQ::AndCondition(
  100. QQ::Equal(QQN::PaypalTransaction()->Param1, $strParam1),
  101. QQ::Equal(QQN::PaypalTransaction()->Param2, $intParam2)
  102. ),
  103. $objOptionalClauses
  104. );
  105. }
  106. public static function LoadArrayBySample($strParam1, $intParam2, $objOptionalClauses) {
  107. // Performing the load manually (instead of using Qcodo Query)
  108. // Get the Database Object for this Class
  109. $objDatabase = PaypalTransaction::GetDatabase();
  110. // Properly Escape All Input Parameters using Database->SqlVariable()
  111. $strParam1 = $objDatabase->SqlVariable($strParam1);
  112. $intParam2 = $objDatabase->SqlVariable($intParam2);
  113. // Setup the SQL Query
  114. $strQuery = sprintf('
  115. SELECT
  116. `paypal_transaction`.*
  117. FROM
  118. `paypal_transaction` AS `paypal_transaction`
  119. WHERE
  120. param_1 = %s AND
  121. param_2 < %s',
  122. $strParam1, $intParam2);
  123. // Perform the Query and Instantiate the Result
  124. $objDbResult = $objDatabase->Query($strQuery);
  125. return PaypalTransaction::InstantiateDbResult($objDbResult);
  126. }
  127. */
  128. }
  129. ?>