原则自动增量起始值@ORM \ GeneratedValue [英] Doctrine Auto Increment Starting Value @ORM\GeneratedValue

查看:143
本文介绍了原则自动增量起始值@ORM \ GeneratedValue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用注释设置自动递增ID的起始值?

How can I set the starting value for an Auto Incremented id using annotations ?

我希望它开始于250000

I want it to start at 250000

/**
 * @ORM\Id
 * @ORM\GeneratedValue
 * @ORM\Column(type="integer")
 */
protected $id;

推荐答案

/**
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="SEQUENCE")
 * @ORM\SequenceGenerator(sequenceName="id", initialValue=250000)
 * @ORM\Column(type="integer")
 */
 protected $id;

http://doctrine-orm.readthedocs.org/en/latest/reference /basic-mapping.html

这篇关于原则自动增量起始值@ORM \ GeneratedValue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆