0

We are building an online payment system using Zend Framework and we try to design it to make it easier to add new payment systems. Currently we have an implementation for PayPal, but maybe we want to add other providers later too.

We have a Payment object that extends Zend_Db_Table_Row_Abstract and a Payments object extending Zend_Db_Table_Abstract. The Payment object now has PayPal specific data in its row which we want to move to a different, PayPal specific, table. This enables us to have general data for payments in the payments table and payment provider specific data in another.

Now we tried to make a class PayPalPayment extending Payment and a class PayPalPayments extending Zend_Db_Table_Abstract. The PayPalPayments refers to our new database table and the new object PayPalPayment. What we want to do now is:

$ppp = new PayPalPayments();
$p = $ppp->createRow();
//set a paypal specific property. setToken is defined in PayPalPayment
$p->setToken('lol');
//set a Payment general property. setStatus is defined in Payment
$p->setStatus('paid');
//write to database
$p->save();

However, we cannot get this to work since the createRow will only return a row with the columns in the PayPalPayment table. So this would give the error:

Specified column "pay_status" is not in the row

Found some things about relations in the Zend framework documentation, but that's not really how we want to do it. Anyone tried this before?

Regards, Lars

1 Answer 1

1

Did you declare in class PayPalPayments that the default $_rowClass = 'PayPalPayment'?

Sign up to request clarification or add additional context in comments.

1 Comment

Yes we did. The problem is that if we do: $p = new PayPalPayments(); $payment = $p->createRow(); The $payment does not recognize the columns in the Payments table, only the columns in our new paypal_payments table. So when we try to set a value to a property from the payments table, it gives the error that the column is not in the row.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.