*/ class Mage_Sales_Model_Resource_Billing_Agreement extends Mage_Core_Model_Resource_Db_Abstract { /** * Resource initialization * */ protected function _construct() { $this->_init('sales/billing_agreement', 'agreement_id'); } /** * Add order relation to billing agreement * * @param int $agreementId * @param int $orderId * @return Mage_Sales_Model_Resource_Billing_Agreement */ public function addOrderRelation($agreementId, $orderId) { $this->_getWriteAdapter()->insert( $this->getTable('sales/billing_agreement_order'), array( 'agreement_id' => $agreementId, 'order_id' => $orderId ) ); return $this; } }