<bdo id='PGbU7'></bdo><ul id='PGbU7'></ul>
    1. <tfoot id='PGbU7'></tfoot>

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

    3. <small id='PGbU7'></small><noframes id='PGbU7'>

    4. Doctrine 2 WHERE IN 子句使用实体集合

      Doctrine 2 WHERE IN clause using a collection of entities(Doctrine 2 WHERE IN 子句使用实体集合)
    5. <legend id='jiyDt'><style id='jiyDt'><dir id='jiyDt'><q id='jiyDt'></q></dir></style></legend>
      1. <i id='jiyDt'><tr id='jiyDt'><dt id='jiyDt'><q id='jiyDt'><span id='jiyDt'><b id='jiyDt'><form id='jiyDt'><ins id='jiyDt'></ins><ul id='jiyDt'></ul><sub id='jiyDt'></sub></form><legend id='jiyDt'></legend><bdo id='jiyDt'><pre id='jiyDt'><center id='jiyDt'></center></pre></bdo></b><th id='jiyDt'></th></span></q></dt></tr></i><div id='jiyDt'><tfoot id='jiyDt'></tfoot><dl id='jiyDt'><fieldset id='jiyDt'></fieldset></dl></div>
          <tfoot id='jiyDt'></tfoot>

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

                <bdo id='jiyDt'></bdo><ul id='jiyDt'></ul>
                  <tbody id='jiyDt'></tbody>
                本文介绍了Doctrine 2 WHERE IN 子句使用实体集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试在 Doctrine 2 中构建一个查询,以查找与任何给定 VacancyWorkingHours 实体相关的所有 Vacancy 实体.

                I'm attempting to build a query in Doctrine 2 that finds all Vacancy entities which are related to any of the given VacancyWorkingHours entities.

                Vacancy 实体如下所示:

                /**
                 * Vacancy
                 *
                 * @ORMTable(name="vacancy")
                 * @ORMEntity(repositoryClass="JaikDeanCareersBundleEntityVacancyRepository")
                 */
                class Vacancy
                {
                    /**
                     * @var integer
                     *
                     * @ORMColumn(name="id", type="integer")
                     * @ORMId
                     * @ORMGeneratedValue(strategy="AUTO")
                     */
                    private $id;
                
                    /**
                     * @var VacancyWorkingHours
                     *
                     * @ORMManyToOne(targetEntity="VacancyWorkingHours", inversedBy="vacancies")
                     * @ORMJoinColumn(name="vacancy_working_hours_id", referencedColumnName="id")
                     **/
                    private $workingHours;
                
                    /* Other fields and methods are inconsequential */
                }
                

                我的查询当前如下所示,但由于 where 子句,没有返回任何结果.在此示例中,$workingHours 是一个 DoctrineCommonCollectionsArrayCollection 实例,其中包含许多 VacancyWorkingHours 实体

                My query currently looks as follows, but returns no results because of the where clause. In this example, $workingHours is a DoctrineCommonCollectionsArrayCollection instance containing a number of VacancyWorkingHours entities

                $q = $this->createQueryBuilder('v')
                    ->select('v')
                    ->andWhere('v.workingHours IN (:workingHours)')
                    ->setParameter('workingHours', $workingHours->toArray());
                ;
                

                推荐答案

                一个 拉取请求 我提出了这个问题已合并到 Doctrine ORM 2.5 中,因此您现在可以简单地执行此操作:

                A pull request I made about this has been merged into Doctrine ORM 2.5, so you can simply do this now:

                $q = $this->createQueryBuilder('v')
                    ->select('v')
                    ->andWhere('v.workingHours IN (:workingHours)')
                    ->setParameter('workingHours', $workingHours);
                ;
                

                最新版本的 Doctrine 现在允许集合参数,并且会自动使用每个集合条目的主键.

                The latest version of Doctrine now allows collection parameters and will automatically make use of the primary key of each of the collection entries.

                这篇关于Doctrine 2 WHERE IN 子句使用实体集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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 的问题)
              • <tfoot id='5pD6p'></tfoot>

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

                    • <bdo id='5pD6p'></bdo><ul id='5pD6p'></ul>
                        <tbody id='5pD6p'></tbody>

                        <small id='5pD6p'></small><noframes id='5pD6p'>

                          <legend id='5pD6p'><style id='5pD6p'><dir id='5pD6p'><q id='5pD6p'></q></dir></style></legend>