logo
Ask your Symfony questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$5
Why would this code not execute nor throw an error?

Can anyone suggest what is wrong, or how I might get a meaningful error message?

The first log message shows up in the logs, as you would expect. None of the following messages show up in the logs. Nor do any errors appear in the Apache error logs. Nor does the code execute, beyond that first log message.

PaymentOutgoingToTmaPeer is a new class and I assume the problem has something to do with it. But why would there be no error message in the Apache logs?

                                                                                                                     
public function initiate3rdPartyPayment($paypalTransactionId, $theQuestion) {
$isThisACodewiseSite = sfConfig::get('app_is_this_a_codewise_site');
if ($isThisACodewiseSite == 'yes') {
$email = 'me@yahoo.com';
} else {
$email = 'codewi@codewi.se';
}

$this->logMessage("In question/initiate3rdPartyPayment: we were asked to send a payment for paypal transaction id '$paypalTransactionId' and the question id is {$theQuestion->getId()} and the email is $email. We have not yet sent a payment. We will now determine whether or not we have already made a payment on this transaction. ", 'crit');

$c = new Criteria();
$c->add(PaymentOutgoingToTmaPeer::PAYPAL_TRANSACTION_ID_FOR_ORIGINAL_PAYMENT, $paypalTransactionId);
$thisTransaction = PaymentOutgoingToTmaPeer::doSelectOne($c);

if (getClass($thisTransaction) == 'PaymentOutgoingToTma') {
$this->logMessage("In question/initiate3rdPartyPayment: we were asked to send a payment for paypal transaction id '$paypalTransactionId' but a payment for this transaction has already been recorded. If we get here then PayPal is probably pinging us twice for the same question, whose id is: " . $theQuestion->getId(), 'crit');

} else {

$this->logMessage("In question/initiate3rdPartyPayment: we were asked to send a payment for paypal transaction id '$paypalTransactionId' and the question id is {$theQuestion->getId()} and the email is $email. We have determined that this transaction has not happened previously we we will use PaymentOutgoingToTma to make a record of this next mass payment.", 'crit');

$thirdPartyTransactionObject = new PaymentOutgoingToTma();
$thirdPartyTransactionObject->setDate(date('Y-m-d h:i:s'));
$thirdPartyTransactionObject->setPaypalTransactionIdForOriginalPayment($paypalTransactionId);
$thirdPartyTransactionObject->setEmail($email);
$thirdPartyTransactionObject->save();

$isThisACodewiseSite = sfConfig::get('app_is_this_a_codewise_site');
if ($isThisACodewiseSite == 'yes') {
$moneyForL = $theQuestion->getPrizeAmount() * .05;
$this->paypalMassPayTo3rdPartiesIncludingUs($moneyForL, $email);
} else {
$moneyForCodewise = $theQuestion->getPrizeAmount() * .02;
$this->paypalMassPayTo3rdPartiesIncludingUs($moneyForCodewise, $email);
}

$this->logMessage("In question/initiate3rdPartyPayment: we were asked to send a payment for paypal transaction id '$paypalTransactionId' and the question id is {$theQuestion->getId()} and the email is $email. We are now at the end of the function. We have probably sent a payment ", 'crit');
}
}



And yes, I'm aware the code is terribly redundant. I've been tearing it to pieces trying to figure out this bug. If I could just this code to work, then I would clean it up.

This question has been answered.

Lawrence Krubner | 11/30/10 at 12:29am Edit


The experts have suggested, on average, a prize of $3 for this question.

(3) Responses

See a threaded view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    11/30/10
    11:10am
    Christian Schaefer says:

    I think its this line:


    if (getClass($thisTransaction) == 'PaymentOutgoingToTma') {

    If I'm not mistaken the function getClass() does not exist and you meant to call get_class().
    Things like these often crash between the parser and the runtime. It escapes me why there are no errors whatsoever but i experiences the same thing more than once.

    Previous versions of this answer: 11/30/10 at 3:03am | 11/30/10 at 3:03am

  • avatar
    Last edited:
    11/30/10
    10:38am
    José Nahuel Cuesta Luengo says:

    As Christian says, get_class() is the correct function. But aside from that, you should check your server's PHP configuration to set it to show errors (if you are in a 'dev' environment).

    As a side-tip, consider using transactions in methods like this one where related objects are to be saved to the database.

  • avatar
    Last edited:
    11/30/10
    11:09am
    Lawrence Krubner says:

    Damn, I hate stuff like that. Was staring at the code for over an hour and just not seeing it. Stupid little typo.

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.