簡體   English   中英

Symfony Payum Bundle:“Proxies\__CG__\App\Entity\Payment”的存儲擴展已注冊到網關

[英]Symfony Payum Bundle: Storage Extension for "Proxies\__CG__\App\Entity\Payment" is registered to the gateway

幾個小時以來,我一直在尋找以下錯誤的解決方案:

我想使用網關(條帶和 paypal + 離線測試)進行支付,但每次我想打開捕獲鏈接時,都會出現以下異常:

不支持請求捕獲{model: Identity}。 確保“ Proxies_CG _\App\Entity\Payment”的存儲擴展已注冊到網關。 確保存儲查找方法返回 id 為“1”的實例。 確保網關支持請求並且有支持此請求的操作(該方法返回 true)。 可能存在錯誤,因此請在問題跟蹤器上查找相關問題。

我有以下配置:

  • PHP 7.4
  • payum/payum-bundle v2.4
  • symfony 5.2.3

相關片段:

payum.yaml

payum:
    storages:
        App\Entity\Payment: { doctrine: orm }

    security:
        token_storage:
            App\Entity\PaymentToken: { doctrine: orm }

    gateways: [...]

實體\付款

<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Payum\Core\Model\Payment as BasePayment;

/**
 * @ORM\Table
 * @ORM\Entity
 */
class Payment extends BasePayment
{
    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     *
     * @var integer $id
     */
    protected $id;
}

實體\PaymentToken

<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Payum\Core\Model\Token;

/**
 * @ORM\Table
 * @ORM\Entity
 */
class PaymentToken extends Token
{

}

doctrine.yaml(配置/包)

doctrine:
    dbal:
        url: '%env(resolve:DATABASE_URL)%'

        # IMPORTANT: You MUST configure your server version,
        # either here or in the DATABASE_URL env var (see .env file)
        #server_version: '5.7'
    orm:
        auto_generate_proxy_classes: true
        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
        auto_mapping: true
        mappings:
            App:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/Entity'
                prefix: 'App\Entity'
                alias: App
        dql:
            numeric_functions:
                Rand: App\DQL\RandFunction

用於創建付款的代碼段

$storage = $this->payum->getStorage('App\Entity\Payment');

$payment = $storage->create();
$payment->setNumber(uniqid());
$payment->setCurrencyCode('EUR');
$payment->setDescription('[...]');
$payment->setClientId($user->getId());
$payment->setClientEmail($user->getEmail());

$storage->update($payment);

$captureToken = $this->payum->getTokenFactory()->createCaptureToken(
    'offline',
    $payment,
    'index'
);

並通過打開捕獲 URL ($capureToken->getTargetURL()) 我從上面得到異常。 我嘗試了與其他 stackoverflow-posts 不同的解決方案,例如清除緩存、使用 no-dev 和其他方法進行預熱,但沒有任何效果。 我多次遵循 payum 和捆綁包的(在某些情況下可怕的)文檔,使用完全相同的片段但沒有任何結果。

我只是希望這里有人可以幫助我,否則我有點搞砸了。

謝謝!

好吧,似乎與支付實體的關系存在問題。 我有另一個與支付實體有多對一關系的實體。 通過刪除它並在沒有任何關系的情況下執行支付實體,它工作得很好......

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM