JMSPaymentCoreBundle:当doctrine:schema:update --force时出错

时间:2015-04-24 13:11:42

标签: symfony doctrine-orm jmspaymentpaypalbundle

我正在尝试实现JMSPaymentCoreBundle,但我在下面收到此错误。

[Doctrine\ORM\Mapping\MappingException]                                                                                              
The target-entity CTC\Bundle\OrderBundle\Entity\JMSPaymentCore:PaymentInstruction cannot be found in 'CTC\Bundle\OrderBundle\Entity\Order#paymentInstruction'.

我在文档中遗漏了什么吗?也许与命名空间或targetEntity值不匹配但我不明白。

我也注意到在我的学说:generate:entities之后,setter和getter看起来很奇怪。

有什么想法吗?我感谢你的帮助。

这是我的完整Order实体类:

<?php
namespace CTC\Bundle\OrderBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use JMS\Payment\CoreBundle\Entity\PaymentInstruction;

/**
 * Orders
 *
 * @ORM\Table(name="Orders")
 * @ORM\Entity(repositoryClass="CTC\Bundle\OrderBundle\Repository\OrdersRepository")
 */
class Order
{
    /**
     * @var integer
     *
     * @ORM\Column(name="OrderID", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /** @ORM\OneToOne(targetEntity="JMSPaymentCore:PaymentInstruction") */
    private $paymentInstruction;

    /**
     * @var string
     *
     * @ORM\Column(name="OrderReference", type="string", length=100)
     */
    private $reference;

    /**
     *
     * @ORM\ManyToOne(targetEntity="CTC\Bundle\UserBundle\Entity\User", inversedBy="orders")
     * @ORM\JoinColumn(name="UserID", referencedColumnName="id")
     */
    private $user;

    /**
     *
     * @ORM\ManyToOne(targetEntity="CTC\Bundle\CreditPackageBundle\Entity\CreditPackage")
     * @ORM\JoinColumn(name="CreditPackageID", referencedColumnName="CreditPackageID")
     */
    private $package;


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set reference
     *
     * @param string $reference
     * @return Orders
     */
    public function setReference($reference)
    {
        $this->reference = $reference;

        return $this;
    }

    /**
     * Get reference
     *
     * @return string 
     */
    public function getReference()
    {
        return $this->reference;
    }

    /**
     * Set user
     *
     * @param \CTC\Bundle\UserBundle\Entity\User $user
     * @return Order
     */
    public function setUser(\CTC\Bundle\UserBundle\Entity\User $user = null)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * Get user
     *
     * @return \CTC\Bundle\UserBundle\Entity\User 
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Set package
     *
     * @param \CTC\Bundle\CreditPackageBundle\Entity\CreditPackage $package
     * @return Order
     */
    public function setPackage(\CTC\Bundle\CreditPackageBundle\Entity\CreditPackage $package = null)
    {
        $this->package = $package;

        return $this;
    }

    /**
     * Get package
     *
     * @return \CTC\Bundle\CreditPackageBundle\Entity\CreditPackage 
     */
    public function getPackage()
    {
        return $this->package;
    }

    /**
     * Set paymentInstruction
     *
     * @param \CTC\Bundle\OrderBundle\Entity\JMSPaymentCore:PaymentInstruction $paymentInstruction
     * @return Order
     */
    public function setPaymentInstruction(\CTC\Bundle\OrderBundle\Entity\JMSPaymentCore:PaymentInstruction $paymentInstruction = null)
    {
        $this->paymentInstruction = $paymentInstruction;

        return $this;
    }

    /**
     * Get paymentInstruction
     *
     * @return \CTC\Bundle\OrderBundle\Entity\JMSPaymentCore:PaymentInstruction 
     */
    public function getPaymentInstruction()
    {
        return $this->paymentInstruction;
    }
}

1 个答案:

答案 0 :(得分:3)

您输入了错误的命名空间语法。

@ORM\OneToOne(targetEntity="JMSPaymentCore:PaymentInstruction")

此处不接受:的短语法。

查看其他名称空间声明并使用完整名称空间修复它。

@ORM\ManyToOne(targetEntity="CTC\Bundle\CreditPackageBundle\Entity\CreditPackage")

喜欢这个。

- 更新 -

我相信,这应该是完整的命名空间JMS\Payment\CoreBundle\Entity\PaymentInstruction