In doctrine2 I have an entity that has a primary key that's feeded from a webservice, and also has an index that should be an auto increment.
I can set manually in mysql but can't make this work in doctrine2.
I used columnDefinition
of INT AUTO_INCREMENT UNIQUE
/**
* @var integer
*
* @ORM\Column(type="integer", name="sequence", nullable=true, columnDefinition="INT AUTO_INCREMENT UNIQUE")
*/
protected $sequence = null;
Doctrine migration bundle generates
$this->addSql('ALTER TABLE table_name_here ADD sequence INT AUTO_INCREMENT UNIQUE');
Edit: Note that this answer is from 2016, it may no longer be valid. See accepted answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With