I want to do composite unique key in doctrine. Those are my fields:
/**
* @var string $videoDimension
*
* @Column(name="video_dimension", type="string", nullable=false)
*/
private $videoDimension;
/**
* @var string $videoBitrate
*
* @Column(name="video_bitrate", type="string", nullable=false)
*/
private $videoBitrate;
How can I show doctrine, that those combined together are composite unique key?
Answer the question:
use Doctrine\ORM\Mapping\UniqueConstraint;
/**
* Common\Model\Entity\VideoSettings
*
* @Table(name="video_settings",
* uniqueConstraints={
* @UniqueConstraint(name="video_unique",
* columns={"video_dimension", "video_bitrate"})
* }
* )
* @Entity
*/