Doctrine and composite unique keys
I find it more verbose to use
only ORM and then prefix ORM
in annotations. Also note that you can break annotation to several lines to make it more readable especially if you have several items to mention (index in the example below).
use Doctrine\ORM\Mapping as ORM;
/**
* VideoSettings
*
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
* @ORM\Entity(repositoryClass="AppBundle\Repository\VideoSettingsRepository")
* @ORM\Table(name="emails", uniqueConstraints={
* @ORM\UniqueConstraint(name="dimension_bitrate", columns={"video_dimension", "video_bitrate"})
* }, indexes={
* @ORM\Index(name="name", columns={"name"})
* })
*/
class VideoSettings
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
*/
See @UniqueConstraint