User Tools

symfony orm

multiple constraints

in the entity file

/**
 * @ORM\Table(name="unique_test",uniqueConstraints={@ORM\UniqueConstraint(name="unique_idx", columns={"col1", "col2"})})
 */
class UniqueTest
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=255)
     */
    private $col1;

    /**
     * @ORM\Column(type="string", length=255)
     */
    private $col2;

    /**
     * @ORM\Column(type="string", length=255)
     */
    private $col3;

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information