<bdo id='XYYMv'></bdo><ul id='XYYMv'></ul>
<tfoot id='XYYMv'></tfoot>

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

      1. <i id='XYYMv'><tr id='XYYMv'><dt id='XYYMv'><q id='XYYMv'><span id='XYYMv'><b id='XYYMv'><form id='XYYMv'><ins id='XYYMv'></ins><ul id='XYYMv'></ul><sub id='XYYMv'></sub></form><legend id='XYYMv'></legend><bdo id='XYYMv'><pre id='XYYMv'><center id='XYYMv'></center></pre></bdo></b><th id='XYYMv'></th></span></q></dt></tr></i><div id='XYYMv'><tfoot id='XYYMv'></tfoot><dl id='XYYMv'><fieldset id='XYYMv'></fieldset></dl></div>
      2. <legend id='XYYMv'><style id='XYYMv'><dir id='XYYMv'><q id='XYYMv'></q></dir></style></legend>
      3. Doctrine2 findBy 关系对象触发字符串转换错误

        Doctrine2 findBy relationship object triggers string conversion error(Doctrine2 findBy 关系对象触发字符串转换错误)
          <bdo id='0wfvg'></bdo><ul id='0wfvg'></ul>

          <small id='0wfvg'></small><noframes id='0wfvg'>

          <tfoot id='0wfvg'></tfoot>

                  <tbody id='0wfvg'></tbody>
              1. <i id='0wfvg'><tr id='0wfvg'><dt id='0wfvg'><q id='0wfvg'><span id='0wfvg'><b id='0wfvg'><form id='0wfvg'><ins id='0wfvg'></ins><ul id='0wfvg'></ul><sub id='0wfvg'></sub></form><legend id='0wfvg'></legend><bdo id='0wfvg'><pre id='0wfvg'><center id='0wfvg'></center></pre></bdo></b><th id='0wfvg'></th></span></q></dt></tr></i><div id='0wfvg'><tfoot id='0wfvg'></tfoot><dl id='0wfvg'><fieldset id='0wfvg'></fieldset></dl></div>
                <legend id='0wfvg'><style id='0wfvg'><dir id='0wfvg'><q id='0wfvg'></q></dir></style></legend>
                  本文介绍了Doctrine2 findBy 关系对象触发字符串转换错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  假设我在 Doctrine2 中有两个相互关联的实体,ModelsUser 和 ModelsComment.如果我在 Doctrine 2.0.0 中这样做...

                  Say I have two entities in Doctrine2 that are related to each other, ModelsUser and ModelsComment. If I do this in Doctrine 2.0.0...

                  <?php
                  // $em instanceof EntityManager, $user instanceof ModelsUser
                  $comments = $em->getRepository('ModelsComment')
                      ->findBy(array('user' => $user, 'public' => true));
                  

                  ...我收到一个 PHP 错误:

                  ...I get a PHP error:

                  严重性:注意

                  消息:ModelsUser 类对象到字符串的转换

                  Message: Object of class ModelsUser to string conversion

                  文件名:DBAL/Connection.php

                  Filename: DBAL/Connection.php

                  行号:574

                  这不应该发生,对吧?如果我使用 QueryBuilder 和 setParameter('user', $user) 它会按预期工作.

                  This shouldn't happen, right? If I use the QueryBuilder and setParameter('user', $user) it works as expected.

                  推荐答案

                  允许按关系查询,但必须在那里传递标识符.尚不支持按对象查询,只会在 2.1 中实现.

                  Query by relationship is allowed, but you have to pass the Identifier in there. Query by object is not yet supported and will only make it into 2.1.

                  <?php
                  // $em instanceof EntityManager, $user instanceof ModelsUser
                  $comments = $em->getRepository('ModelsComment')
                  ->findBy(array('user' => $user->getId(), 'public' => true));
                  

                  这篇关于Doctrine2 findBy 关系对象触发字符串转换错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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() 函数)

                  <legend id='0ug4K'><style id='0ug4K'><dir id='0ug4K'><q id='0ug4K'></q></dir></style></legend>
                    • <bdo id='0ug4K'></bdo><ul id='0ug4K'></ul>
                        <tbody id='0ug4K'></tbody>

                          <small id='0ug4K'></small><noframes id='0ug4K'>

                        1. <tfoot id='0ug4K'></tfoot>

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