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