Payum Duplicate entry '0' for key 'PRIMARY'

225 views Asked by At

i am using the payumBundle for my payment set ups but i keep getting this error:

Duplicate entry '0' for key 'PRIMARY'

These are my classes that i am using

/**
 * @ORM\Table(name="payum_tokenized_details")
 * @ORM\Entity
 */
class TokenizedDetails extends BaseTokenizedDetails
{

    protected $id;

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


}

/**
 * @ORM\Table(name="payum_paypal_express_checkout_payment_details")
 * @ORM\Entity
 */
class PaypalExpressPaymentDetails extends PaymentDetails
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

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


}

i have tried to search but i can't seem to find a solution, normally this is because of the primary keys, but those are all set up correctly

1

There are 1 answers

1
Maksim Kotlyar On

The TokenizedDetails entity must not have id field because there is token one (which is unique ) and already had been mapped.

See how its defined in sandbox: https://github.com/Payum/PayumBundleSandbox/blob/master/src/Acme/PaymentBundle/Entity/TokenizedDetails.php

And the mapping: https://github.com/Payum/Payum/blob/master/src/Payum/Bridge/Doctrine/Resources/mapping/TokenizedDetails.orm.xml

Pay attention to token field its defined as id.