Open martynling opened 10 years ago
@martynling thanks for sharing! is this working version?
I am not yii expert so it would be hard for me to review, in any case I would do it.
@martynling could you write a chapter how to use it
so I can install it on my yii sandbox and play a bit.
here's sandbox repo: https://github.com/makasim/PayumYiiSandbox
@makasim Yes, it's a working version. I'll write the "how to use it" section next week sometime. Glad to share. :-)
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.
Could it be possible to create TokenActiveRecord that implements TokenInterface? payum expects 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).
same here, why should we hide active record inside the other model. Why not create active record model that implements array access interface?
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.
I am looking forward to merge it (:. indeed we have to clean things up a bit
@makasim Sorry for the delay on this - I moved house last weekend and there's a problem getting connected to the Internet. I should be fully back in action next week and will get to work on this then.
@martynling congrats on moving to new house!
@martynling any news on this?
@makasim Still got connection problems... and there have been 2 days of public holiday so no progress. Once I get connected again, I'll get to it. Next week, hopefully.
@makasim I've added the How to use... chapter this morning. Let me know what you think.
great! I will try it in my sandbox asap.
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:
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.