我想在学说中做复合唯一键。 这些是我的领域:
/**
* @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;
我如何证明那些组合在一起是复合唯一键的学说?
最佳答案
回答问题:
use Doctrine\ORM\Mapping\UniqueConstraint;
/**
* Common\Model\Entity\VideoSettings
*
* @Table(name="video_settings",
* uniqueConstraints={
* @UniqueConstraint(name="video_unique",
* columns={"video_dimension", "video_bitrate"})
* }
* )
* @Entity
*/
关于php - 教义和复合唯一键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12641698/