Issues trying the plugin
Closed this issue · 4 comments
Getting this error when trying to edit any payment method:
Neither the property "mollieGatewayConfig" nor one of the methods "getMollieGatewayConfig()", "mollieGatewayConfig()", "isMollieGatewayConfig()", "hasMollieGatewayConfig()", "__get()" exist and have public access in class "Proxies\__CG__\App\Entity\Payment\GatewayConfig".
Trying to extend BitBag\SyliusMolliePlugin\Entity\GatewayConfig
won't help since $mollieGatewayConfig is private.
Trying to implement BitBag\SyliusMolliePlugin\Entity\GatewayConfigInterface
generates a different error when using "Load methods":
Argument 1 passed to BitBag\SyliusMolliePlugin\Entity\MollieGatewayConfig::setGateway() must be an instance of BitBag\SyliusMolliePlugin\Entity\GatewayConfig, instance of App\Entity\Payment\GatewayConfig given, called in \vendor\bitbag\mollie-plugin\src\Factory\MollieGatewayConfigFactory.php on line 45
The interface declares public function setGateway(GatewayConfig $gateway): void;
instead of using GatewayConfigInterface
.
hello,
I try this (dirty?) workaround: copy / paste the content of \BitBag\SyliusMolliePlugin\Entity\GatewayConfig
into \App\Entity\Payment\GatewayConfig
The error disapear, but I found another bug when I try to "load methods" (I will create a different issue for this point)
hello,
I try something new this morning.
First I revert the workaround mention previously.
Then, in config/packages/_sylius.yaml
, I change this:
sylius_payum:
resources:
payment_security_token:
classes:
model: App\Entity\Payment\PaymentSecurityToken
gateway_config:
classes:
- model: App\Entity\Payment\GatewayConfig
+ model: BitBag\SyliusMolliePlugin\Entity\GatewayConfig
+ interface: BitBag\SyliusMolliePlugin\Entity\GatewayConfigInterface
Plugin seems to works, the error mentioned in #15 is fixed.
But is it the right way to do this? How can we handle additional payment method from other plugins?
You assume that my App\Entity\Payment\GatewayConfig
class doesn't have any other changes and that I can just replace it with BitBag\SyliusMolliePlugin\Entity\GatewayConfig
.
The functionality used in the BitBag\SyliusMolliePlugin\Entity\GatewayConfig
class should be easy to be added to my GatewayConfig class via a trait.
Also, where you expect to have BitBag\SyliusMolliePlugin\Entity\GatewayConfig
injected, replace it with BitBag\SyliusMolliePlugin\Entity\GatewayConfigInterface
, because my App\Entity\Payment\GatewayConfig
class can implement BitBag\SyliusMolliePlugin\Entity\GatewayConfigInterface
and problem should be solved. I will also test this.
side effect or not, can't deliver to UAT (prod env), an error occurred during the cache compilation
$ bin/console cache:clear
// Clearing the cache for the prod environment with debug false
// Warming up cache...
In InvalidArgumentException.php line 94:
[Doctrine\Common\Proxy\Exception\InvalidArgumentException]
Unable to create a proxy for a final class "BitBag\SyliusMolliePlugin\Entity\MollieGatewayConfig".