2 namespace wcf\data\paid\subscription\transaction\log;
3 use wcf\data\object\type\ObjectTypeCache;
4 use wcf\data\paid\subscription\PaidSubscription;
5 use wcf\data\user\User;
6 use wcf\data\DatabaseObject;
10 * Represents a paid subscription transaction log entry.
13 * @copyright 2001-2014 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package com.woltlab.wcf
16 * @subpackage data.paid.subscription.transaction.log
17 * @category Community Framework
19 class PaidSubscriptionTransactionLog extends DatabaseObject {
21 * @see \wcf\data\DatabaseObject::$databaseTableName
23 protected static $databaseTableName = 'paid_subscription_transaction_log';
26 * @see \wcf\data\DatabaseObject::$databaseIndexName
28 protected static $databaseTableIndexName = 'logID';
32 * @var \wcf\data\user\User
34 protected $user = null;
37 * paid subscription object
38 * @var \wcf\data\paid\subscription\PaidSubscription
40 protected $subscription = null;
43 * Returns the payment method of this transaction.
47 public function getPaymentMethodName() {
48 $objectType = ObjectTypeCache::getInstance()->getObjectType($this->paymentMethodObjectTypeID);
49 return $objectType->objectType;
53 * Returns transaction details.
57 public function getTransactionDetails() {
58 return unserialize($this->transactionDetails);
62 * Returns the user of this transaction.
64 * @return \wcf\data\user\User
66 public function getUser() {
67 if ($this->user === null) {
68 $this->user = new User($this->userID);
75 * Returns the paid subscription of this transaction.
77 * @return \wcf\data\paid\subscription\PaidSubscription
79 public function getSubscription() {
80 if ($this->subscription === null) {
81 $this->subscription = new PaidSubscription($this->subscriptionID);
84 return $this->subscription;
88 * Gets a transaction log entry by transaction id.
90 * @param integer $paymentMethodObjectTypeID
91 * @param string $transactionID
92 * @return \wcf\data\paid\subscription\transaction\log\PaidSubscriptionTransactionLog
94 public static function getLogByTransactionID($paymentMethodObjectTypeID, $transactionID) {
96 FROM wcf".WCF_N."_paid_subscription_transaction_log
97 WHERE paymentMethodObjectTypeID = ?
98 AND transactionID = ?";
99 $statement = WCF::getDB()->prepareStatement($sql);
100 $statement->execute(array($paymentMethodObjectTypeID, $transactionID));
101 $row = $statement->fetchArray();
102 if ($row !== false) {
103 return new PaidSubscriptionTransactionLog(null, $row);