[TYPO3-paymentlib] unexpected returned object from tx_paymentlib_providerfactory::getProviderObjectByPaymentMethod

Tonni Aagesen goes.to at dev.null
Fri Jul 27 18:07:41 CEST 2007


Franz Holzinger wrote:

> according to the name the method getProviderObjectByPaymentMethod should
> return the providerObject for the specific gateway. It however returns
> the providerProxyObject and not the real providerObject behind.

No, this is because paymentlib is combining two design patterns; 
Abstract Factory and Proxy patterns.

> So line 104 in class.tx_paymentlib_providerfactory.php should be fixed
> to this:
> return $providerProxyObject->getRealInstance();
> 
> And AFAIK in PHP5 the instance to it will be returned and no new object
> will be copied in memory here.
> 
> The providerObject has been registered with
> 
> $providerFactoryObj = &tx_paymentlib_providerfactory::getInstance();
> $providerFactoryObj->registerProviderClass ('tx_paymentlibpaypal_provider');
> 
> Then a providerProxyClass is created internally. This is fine, however
> this has not been intended by the caller and the internals should be
> hidden to him.
> 
> Can anybody confirm this is a bug?
> 
> Or otherwise the function should be copied under the new name to
> getProviderProxyObjectByPaymentMethod to avoid confusion.

As I understand this mail, you are mostly confused about the method name.


-- 
Regards
Tonni Aagesen
www.pil.dk & www.quickpay.dk


More information about the TYPO3-project-paymentlib mailing list