<legend id='ehj5y'><style id='ehj5y'><dir id='ehj5y'><q id='ehj5y'></q></dir></style></legend>

          <bdo id='ehj5y'></bdo><ul id='ehj5y'></ul>
      1. <tfoot id='ehj5y'></tfoot>
      2. <i id='ehj5y'><tr id='ehj5y'><dt id='ehj5y'><q id='ehj5y'><span id='ehj5y'><b id='ehj5y'><form id='ehj5y'><ins id='ehj5y'></ins><ul id='ehj5y'></ul><sub id='ehj5y'></sub></form><legend id='ehj5y'></legend><bdo id='ehj5y'><pre id='ehj5y'><center id='ehj5y'></center></pre></bdo></b><th id='ehj5y'></th></span></q></dt></tr></i><div id='ehj5y'><tfoot id='ehj5y'></tfoot><dl id='ehj5y'><fieldset id='ehj5y'></fieldset></dl></div>

        <small id='ehj5y'></small><noframes id='ehj5y'>

      3. 在 Doctrine 2 中手动生成下一个序列值

        Generating next sequence value manually in Doctrine 2(在 Doctrine 2 中手动生成下一个序列值)

          • <bdo id='GpEd7'></bdo><ul id='GpEd7'></ul>
              <i id='GpEd7'><tr id='GpEd7'><dt id='GpEd7'><q id='GpEd7'><span id='GpEd7'><b id='GpEd7'><form id='GpEd7'><ins id='GpEd7'></ins><ul id='GpEd7'></ul><sub id='GpEd7'></sub></form><legend id='GpEd7'></legend><bdo id='GpEd7'><pre id='GpEd7'><center id='GpEd7'></center></pre></bdo></b><th id='GpEd7'></th></span></q></dt></tr></i><div id='GpEd7'><tfoot id='GpEd7'></tfoot><dl id='GpEd7'><fieldset id='GpEd7'></fieldset></dl></div>

              <small id='GpEd7'></small><noframes id='GpEd7'>

                  <tfoot id='GpEd7'></tfoot><legend id='GpEd7'><style id='GpEd7'><dir id='GpEd7'><q id='GpEd7'></q></dir></style></legend>
                    <tbody id='GpEd7'></tbody>

                1. 本文介绍了在 Doctrine 2 中手动生成下一个序列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  为具有给定名称的特定序列生成 nextval 的最简单方法是什么?

                  What would be the easiest way to generate nextval for some particular sequence with given name?

                  带指定的注解方案

                   * @ORMGeneratedValue(strategy="SEQUENCE")
                   * @ORMSequenceGenerator(sequenceName="sq_foobar", allocationSize="1", initialValue="1")
                  

                  不满足我,只要涉及一些更复杂的逻辑:在某些情况下我需要检索 nextval,在其他情况下 - 我会使用从其他来源检索的值(不是顺序).

                  doesn't satisfy me, as long as there is some more complex logic involved: in some cases I need to retrieve nextval, in other - I would go with the value retrieved from another sources (not sequence).

                  所以我希望有一种方法可以在实体的构造函数中手动检索序列 nextval.

                  So I hope there is a way to retrieve a sequence nextval manually in entity's constructor.

                  推荐答案

                  那么我认为你应该实现自己的 Identitfer Generator.

                  Then I think you should implement your own Identitfer Generator.

                  最简单的方法是覆盖 DoctrineORMIdSequenceGenerator 类来处理您的特定情况.

                  The easyest would be to override the DoctrineORMIdSequenceGenerator class to handle your specific case.

                  然后,您必须使用 Doctrine ORM API 在类元数据中注册此生成器.

                  You then have to register this generator in the class metadata using Doctrine ORM API.

                  一些链接:http://ranskills.wordpress.com/2011/05/26/how-to-add-a-custom-id-generation-strategy-to-doctrine-2-1/

                  https://github.com/doctrine/doctrine2/pull/206

                  这篇关于在 Doctrine 2 中手动生成下一个序列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Is PHP or PHP based web framework stateful or stateless?(PHP 或基于 PHP 的 Web 框架是有状态的还是无状态的?)
                  How to parse django style template tags(如何解析 django 样式模板标签)
                  What is a good setup for editing PHP in Emacs?(在 Emacs 中编辑 PHP 的好设置是什么?)
                  How to check whether specified PID is currently running without invoking ps from PHP?(如何在不从 PHP 调用 ps 的情况下检查指定的 PID 当前是否正在运行?)
                  What#39;s the difference between escapeshellarg and escapeshellcmd?(escapeshellarg 和escapeshellcmd 有什么区别?)
                  php in background exec() function(php 后台 exec() 函数)
                  • <bdo id='1bqI2'></bdo><ul id='1bqI2'></ul>

                        <legend id='1bqI2'><style id='1bqI2'><dir id='1bqI2'><q id='1bqI2'></q></dir></style></legend>

                      • <tfoot id='1bqI2'></tfoot>
                        1. <i id='1bqI2'><tr id='1bqI2'><dt id='1bqI2'><q id='1bqI2'><span id='1bqI2'><b id='1bqI2'><form id='1bqI2'><ins id='1bqI2'></ins><ul id='1bqI2'></ul><sub id='1bqI2'></sub></form><legend id='1bqI2'></legend><bdo id='1bqI2'><pre id='1bqI2'><center id='1bqI2'></center></pre></bdo></b><th id='1bqI2'></th></span></q></dt></tr></i><div id='1bqI2'><tfoot id='1bqI2'></tfoot><dl id='1bqI2'><fieldset id='1bqI2'></fieldset></dl></div>

                            <tbody id='1bqI2'></tbody>

                            <small id='1bqI2'></small><noframes id='1bqI2'>