Payum/PayumYiiExtension — pull request #4 by martynling (2014-01-03 16:31:18+00:00)
Title: Active record storage

This is a pretty rough but effective means of implementing ActiveRecord storage. I needed ActiveRecord storage working for Payum in a hurry, so found what seemed the simplest solution to me. I suspect that you may want to implement it in a more elegant way, but I did the following:

- For token storage, I extended Payum\Core\Model\Token and gave it an activeRecord property. In the __construct method, when a new object is being created, the activeRecord property is set to a new TokenActiveRecord (an extension of ActiveRecord). Given that Payum is usually expecting a token, I give it a token with the active record more or less hidden within it.
- For payment detail storage, I took a similar approach by extending ArrayObject and giving it an activeRecord property. On __construct it creates a new PaymentActiveRecord (you guessed it, an extension of ActiveRecord).

It needs some tidying up if it were to be merged in... but I'll hold off on doing that since you may not want to merge it in anyway. If you go ahead with a more elegant solution, I'll probably switch to that further down the line.

Anyway, here it is, just in case it's helpful to you or someone else.