Welcome Guest, Not a member yet? Register   Sign In
Application logic inside class or inside model?
#2

[eluser]bscott[/eluser]
Or you could have getStatus and getErrorMessage methods in your Payment class and use

Code:
$z->chargeCard();

if($z->getStatus() == 'success')
{
    echo 'Payment complete';
    // further logic pertaining to a successful payment..
}
else
{
    echo $z->getErrorMessage();
    // further logic pertaining to an failed payment..
}

This way the determination of sucsess/failure and the content of the error is encapsulated in the Payment class and the action taken dependant on the result of the chargeCard method is in the model.


Messages In This Thread
Application logic inside class or inside model? - by El Forum - 01-30-2011, 02:57 PM
Application logic inside class or inside model? - by El Forum - 01-30-2011, 03:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB