0

我的 UserTrack 实体

/**
 * @ORM\Entity(repositoryClass="JJ\MainBundle\Repository\UserTrackRepository")
 * @ORM\Table
 * @UniqueEntity({"user", "track"})
 * @JMS\ExclusionPolicy("all")
 */
class UserTrack implements RateableInterface
...
    /**
     * @ORM\ManyToOne(targetEntity="JJ\MainBundle\Entity\User", inversedBy="user_tracks", fetch="EXTRA_LAZY")
     */
    protected $user;
...
    /**
     * @ORM\ManyToOne(targetEntity="JJ\MainBundle\Entity\Track", inversedBy="user_tracks")
     * @JMS\Expose
     */
    protected $track;
...

当我打电话时:

$this->validator->validate($userTrack);

这是我的例外(当我更新我的实体时):

message": "JJ\\MainBundle\\Entity\\UserTrack.user:\n This value is already used.\n",

虽然我可以清楚地看到它是独一无二的: 在此处输入图像描述

请赐教...

4

0 回答 0