<?php
namespace __APP_NAME__\model;
/**
* PayPal order is a database model that holds all data for a order.
* @Entity
*/
class PayPalOrder extends \gnomephp\paypal\PayPalOrderModel{
// @todo: Add custom fields to order model.
public function __construct($txnId, $payerEmail, $mcGross, $mcCurrency /* Custom fields to constructor . */){
parent::__construct($txnId, $payerEmail, $mcGross, $mcCurrency);
}
/**
* Checks if order is already processed.
* @param string $txnId TXN ID from paypal IPN.
*/
static public function orderProcessed($txnId){
Doctrine::load();
$q = Doctrine::getEM()->createQuery('SELECT p FROM PayPalOrder p WHERE p.txnId = ?1')
->setParameter(1, $txnId);
if ($p = $q->getOneOrNullResult()){
return $p;
}else{
return false;
}
}
}