Open Journal Systems  3.0.0
 All Classes Namespaces Functions Variables Groups Pages
QueuedPaymentDAO.inc.php
1 <?php
2 
19 class QueuedPaymentDAO extends DAO {
23  function QueuedPaymentDAO() {
24  parent::DAO();
25  }
26 
32  function &getQueuedPayment($queuedPaymentId) {
33  $result = $this->retrieve(
34  'SELECT * FROM queued_payments WHERE queued_payment_id = ?',
35  (int) $queuedPaymentId
36  );
37 
38  $queuedPayment = null;
39  if ($result->RecordCount() != 0) {
40  $queuedPayment = unserialize($result->fields['payment_data']);
41  if (!is_object($queuedPayment)) $queuedPayment = null;
42  }
43  $result->Close();
44  return $queuedPayment;
45  }
46 
52  function insertObject($queuedPayment, $expiryDate = null) {
53  $this->update(
54  sprintf('INSERT INTO queued_payments
55  (date_created, date_modified, expiry_date, payment_data)
56  VALUES
57  (%s, %s, %s, ?)',
60  $this->datetimeToDB($expiryDate)),
61  array(
62  serialize($queuedPayment)
63  )
64  );
65 
66  return $queuedPayment->setId($this->getInsertId());
67  }
68 
74  function updateQueuedPayment($queuedPaymentId, &$queuedPayment) {
75  return $this->update(
76  sprintf('UPDATE queued_payments
77  SET
78  date_modified = %s,
79  payment_data = ?
80  WHERE queued_payment_id = ?',
82  array(
83  serialize($queuedPayment),
84  (int) $queuedPaymentId
85  )
86  );
87  }
88 
93  function getInsertId() {
94  return $this->_getInsertId('queued_payments', 'queued_payment_id');
95  }
96 
101  function deleteQueuedPayment($queuedPaymentId) {
102  return $this->update(
103  'DELETE FROM queued_payments WHERE queued_payment_id = ?',
104  array((int) $queuedPaymentId)
105  );
106  }
107 
112  return $this->update(
113  'DELETE FROM queued_payments WHERE expiry_date < now()'
114  );
115  }
116 }
117 
118 ?>
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:30
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:84
& getQueuedPayment($queuedPaymentId)
deleteQueuedPayment($queuedPaymentId)
_getInsertId($table= '', $id= '')
Definition: DAO.inc.php:249
updateQueuedPayment($queuedPaymentId, &$queuedPayment)
insertObject($queuedPayment, $expiryDate=null)
Operations for retrieving and modifying queued payment objects.
datetimeToDB($dt)
Definition: DAO.inc.php:293
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:208
static getCurrentDate($ts=null)
Definition: Core.inc.php:95