0

我正在按照此处的文档设置 Payum:http: //payum.org/doc/0.10/PayumBundle/get_it_started

我在这里使用这个实体作为我的安全令牌:

namespace Acme\PaymentBundle\Entity;

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

/**
 * @ORM\Table(name="payum_security_token")
 * @ORM\Entity
 */
class PayumSecurityToken extends Token
{
}

当我尝试设置我的数据库时,我收到此错误:

$ php app/console doctrine:schema:update --force
[Doctrine\ORM\Mapping\MappingException]                                                          
  No identifier/primary key specified for Entity "Acme\PaymentBundle\Entity\PayumSecurityToken" sub class of "Payum\Core\Model\Token". Every Entity must have an identifier/primary key.      

学说:模式:更新 [--complete] [--dump-sql] [--force] [--em[="..."]]

namespace Acme\DemoBundle\Entity;

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

/**
 * @ORM\Table(name="payum_security_token")
 * @ORM\Entity
 */
class PayumSecurityToken extends Token
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
}

它创建一个只有一列的表:id

我做错了什么或者我能做些什么来解决这个问题?

我的作曲家.json:

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.5.*",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": "~1.2",
    "twig/extensions": "~1.0",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~3.0",
    "sensio/framework-extra-bundle": "~3.0",
    "incenteev/composer-parameter-handler": "~2.0",
    "friendsofsymfony/user-bundle": "~1.3",
    "gedmo/doctrine-extensions": "~2.3",
    "sonata-project/admin-bundle": "~2.2",
    "sonata-project/doctrine-orm-admin-bundle": "~2.2",
    "payum/payum-bundle": "*@stable",
    "payum/paypal-pro-checkout-nvp": "*@stable"
},

谢谢

4

1 回答 1

2

您是否在 config.yml 文件中设置了映射?(我在最后添加了自动映射)。

orm:
    auto_generate_proxy_classes: "%kernel.debug%"
    entity_managers:
        default:
            mappings:
                payum:
                    is_bundle: false
                    type: xml
                    dir: %kernel.root_dir%/../vendor/payum/core/Payum/Core/Bridge/Doctrine/Resources/mapping

                    # set this dir instead if you use `payum/payum` library
                    #dir: %kernel.root_dir%/../vendor/payum/payum/src/Payum/Core/Bridge/Doctrine/Resources/mapping

                    prefix: Payum\Core\Model
            auto_mapping: true
于 2014-07-22T00:39:11.167 回答