<small id='9H1Nj'></small><noframes id='9H1Nj'>

    • <bdo id='9H1Nj'></bdo><ul id='9H1Nj'></ul>

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

        <tfoot id='9H1Nj'></tfoot>
      1. <legend id='9H1Nj'><style id='9H1Nj'><dir id='9H1Nj'><q id='9H1Nj'></q></dir></style></legend>

      2. 对教义的 @OneToMany ArrayCollection 进行排序

        时间:2023-08-18
        <i id='ORlJ8'><tr id='ORlJ8'><dt id='ORlJ8'><q id='ORlJ8'><span id='ORlJ8'><b id='ORlJ8'><form id='ORlJ8'><ins id='ORlJ8'></ins><ul id='ORlJ8'></ul><sub id='ORlJ8'></sub></form><legend id='ORlJ8'></legend><bdo id='ORlJ8'><pre id='ORlJ8'><center id='ORlJ8'></center></pre></bdo></b><th id='ORlJ8'></th></span></q></dt></tr></i><div id='ORlJ8'><tfoot id='ORlJ8'></tfoot><dl id='ORlJ8'><fieldset id='ORlJ8'></fieldset></dl></div>
          <tbody id='ORlJ8'></tbody>

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

        <legend id='ORlJ8'><style id='ORlJ8'><dir id='ORlJ8'><q id='ORlJ8'></q></dir></style></legend>
          <bdo id='ORlJ8'></bdo><ul id='ORlJ8'></ul>
              <tfoot id='ORlJ8'></tfoot>
                  本文介绍了对教义的 @OneToMany ArrayCollection 进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的问题很接近这个,但并不完全适合和我的.

                  My question is close to this one, but does not exactly fit with mine.

                  我在实体中有此列:

                  /**
                   * @var ArrayCollection[SubjectTag]
                   *
                   * @ORMOneToMany(targetEntity="SubjectTag", mappedBy="subject")
                   * @AssertCount(max = 10, maxMessage = "You can't create more than 10 tags.")
                   * @AssertValid()
                   */
                  protected $subjectTags;
                  

                  我想按在SubjectTag.position 中定义的位置对我的标签进行动态排序.

                  I want to dynamically order my tags by a position, defined in SubjectTag.position.

                  推荐答案

                  尝试使用 doctrine2 ORM 功能 对多关联排序 像这样:

                  Try using the doctrine2 ORM functionality for Ordering To-Many Associations like this:

                  /**
                   * @var ArrayCollection[SubjectTag]
                   *
                   * @ORMOneToMany(targetEntity="SubjectTag", mappedBy="subject")
                   * @ORMOrderBy({"position" = "ASC"})
                   * @AssertCount(max = 10, maxMessage = "You can't create more than 10 tags.")
                   * @AssertValid()
                   */
                  protected $subjectTags;
                  

                  希望对您有所帮助

                  这篇关于对教义的 @OneToMany ArrayCollection 进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何判断当前交易是否会改变 Doctrine 2 的任何实体? 下一篇:Symfony2 表单集合:如何从集合中删除实体?

                  相关文章

                      <bdo id='6OfEy'></bdo><ul id='6OfEy'></ul>

                    <small id='6OfEy'></small><noframes id='6OfEy'>

                    <tfoot id='6OfEy'></tfoot>
                    <legend id='6OfEy'><style id='6OfEy'><dir id='6OfEy'><q id='6OfEy'></q></dir></style></legend>

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