symfony: Symfony 2 UniqueEntity with two associations is not working.

use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * @UniqueEntity({"field1", "field2"})
 * @ORM\Table(name = "myentity")
 */
class MyEntity
{
    /**
     * @ORM\ManyToOne(.....)
     * @ORM\JoinColumn(.....)
     */
     protected $field1;

   /**
    * @ORM\ManyToOne(.....)
    * @ORM\JoinColumn(.....)
    */
    protected $field2;
}

It works with non-association fields, though. I am using Symfony 2.1.4 and Doctrine (>=2.2.3,<2.4-dev). Can anyone help? Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

For support, please refer to one of the support channels. If you think you discovered a bug, please open a new issue and provide the needed steps to reproduce it. Thank you for understanding.