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

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

        <bdo id='IjsOZ'></bdo><ul id='IjsOZ'></ul>

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

        “无映射字段"在 Doctrine2 中使用部分查询和复合键时

        quot;No mapped fieldquot; when using partial query and composite keys in Doctrine2(“无映射字段在 Doctrine2 中使用部分查询和复合键时)
        <legend id='pcFoG'><style id='pcFoG'><dir id='pcFoG'><q id='pcFoG'></q></dir></style></legend>

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

            <tfoot id='pcFoG'></tfoot>
              <bdo id='pcFoG'></bdo><ul id='pcFoG'></ul>
                <tbody id='pcFoG'></tbody>
              <i id='pcFoG'><tr id='pcFoG'><dt id='pcFoG'><q id='pcFoG'><span id='pcFoG'><b id='pcFoG'><form id='pcFoG'><ins id='pcFoG'></ins><ul id='pcFoG'></ul><sub id='pcFoG'></sub></form><legend id='pcFoG'></legend><bdo id='pcFoG'><pre id='pcFoG'><center id='pcFoG'></center></pre></bdo></b><th id='pcFoG'></th></span></q></dt></tr></i><div id='pcFoG'><tfoot id='pcFoG'></tfoot><dl id='pcFoG'><fieldset id='pcFoG'></fieldset></dl></div>
                • 本文介绍了“无映射字段"在 Doctrine2 中使用部分查询和复合键时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有两个模型,分别称为 PersonTag.一个Person有多个Tag,Tag主键是person_idtag的复合键(Person $person and $tag 在 Doctrine2 中).

                  I have two models called Person and Tag. One Person has many Tags, and the Tag primary key is a composite key of person_id and tag (Person $person and $tag in Doctrine2).

                  Tag模型中有一个数据字段(BLOB),里面有很多数据.我正在设置一个不需要来自该字段的数据的查询,所以我想设置一个不检索该字段的查询.

                  There is a data field (BLOB) in the Tag model with a lot of data. I am setting up a query that does not require the data from that field, so I want to set up a query that does not retrieve that field.

                  我尝试了以下查询:

                  SELECT c, PARTIAL t.{tag} FROM Contact c LEFT JOIN c.tags
                  

                  在这里,我得到了一些预期的错误类 Tag 的部分字段选择必须包含标识符.没问题,我添加联系人字段:

                  Here, I get the somewhat expected error The partial field selection of class Tag must contain the identifier. No problem, I add the contact field:

                  SELECT c, PARTIAL t.{contact,tag} FROM Contact c LEFT JOIN c.tags
                  

                  但现在,我得到类标签上没有名为联系人"的映射字段.

                  Doctrine2 不支持对复合键的部分查询吗?

                  Does Doctrine2 not support partial queries on composite keys?

                  这是标签类:

                  /** @Entity @Table(name="tag") **/
                  class Tag
                  {
                      /** @Id @ManyToOne(targetEntity="Contact",inversedBy="tags") @var Contact **/
                      protected $contact;
                      /** @Id @Column(type="string",length=10,nullable=false) @var string **/
                      protected $tag;
                      /** @Column(type="blob") **/
                      protected $data;
                  }
                  

                  推荐答案

                  每当执行部分选择时,您都需要包含您从中选择的类的主键.

                  Whenever performing a partial selection you need to include the primary key of the class you're selecting from.

                  您实际上并没有详细说明您的联系人"实体,但我假设该类的主键字段是id".如果是这种情况,那么以下查询将达到您的要求:

                  You haven't actually detailed your "Contact" entity but i'm assuming the primary key field of that class is "id". If this was the case then the following query will acheive what you're after:

                  SELECT c, PARTIAL t.{id, tag} FROM Contact c LEFT JOIN c.tags
                  

                  这似乎没有记录:(

                  http://docs.doctrine-project.org/en/latest/reference/dql-doctrine-query-language.html#partial-object-syntax

                  这篇关于“无映射字段"在 Doctrine2 中使用部分查询和复合键时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    1. <small id='bwvPk'></small><noframes id='bwvPk'>

                        <legend id='bwvPk'><style id='bwvPk'><dir id='bwvPk'><q id='bwvPk'></q></dir></style></legend>
                          <tbody id='bwvPk'></tbody>

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

                        • <bdo id='bwvPk'></bdo><ul id='bwvPk'></ul>
                          <tfoot id='bwvPk'></tfoot>