DDC-2249: Default value sequence #2829

Closed
opened 2026-01-22 14:05:11 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Jan 19, 2013).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user mdev:

I want to have a column on a table that by default it takes the value from a sequence.

I've tried to do something like this:
/****
* @ORM\Column(type="integer", unique="true")
* @ORM\GeneratedValue(strategy="SEQUENCE")
* @ORM\SequenceGenerator(sequenceName="seq_categorias", initialValue=1, allocationSize=100)
*/
protected $id_categoria;

But this doesn't work, it creates de sequence but not the link between the table column and the sequence. Is there any possibility to do something like this? Or any autoincrement default value instead?

Thanks!

Originally created by @doctrinebot on GitHub (Jan 19, 2013). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user mdev: I want to have a column on a table that by default it takes the value from a sequence. I've tried to do something like this: /**** \* @ORM\Column(type="integer", unique="true") \* @ORM\GeneratedValue(strategy="SEQUENCE") \* @ORM\SequenceGenerator(sequenceName="seq_categorias", initialValue=1, allocationSize=100) */ protected $id_categoria; But this doesn't work, it creates de sequence but not the link between the table column and the sequence. Is there any possibility to do something like this? Or any autoincrement default value instead? Thanks!
admin closed this issue 2026-01-22 14:05:12 +01:00
Author
Owner

@doctrinebot commented on GitHub (Apr 16, 2014):

Comment created by @guilhermeblanco:

We cannot fix this as sequences only work internally in Doctrine for ID fields.

@doctrinebot commented on GitHub (Apr 16, 2014): Comment created by @guilhermeblanco: We cannot fix this as sequences only work internally in Doctrine for ID fields.
Author
Owner

@doctrinebot commented on GitHub (Apr 16, 2014):

Issue was closed with resolution "Can't Fix"

@doctrinebot commented on GitHub (Apr 16, 2014): Issue was closed with resolution "Can't Fix"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2829