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

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

          <bdo id='SBrWj'></bdo><ul id='SBrWj'></ul>
      1. Symfony 2:在 ContainerAwareCommand 中禁用 Doctrine 事件侦听器

        Symfony 2: Disable Doctrine event listener in ContainerAwareCommand(Symfony 2:在 ContainerAwareCommand 中禁用 Doctrine 事件侦听器)
        • <small id='d9r9I'></small><noframes id='d9r9I'>

            <tbody id='d9r9I'></tbody>

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

                1. <tfoot id='d9r9I'></tfoot>
                  本文介绍了Symfony 2:在 ContainerAwareCommand 中禁用 Doctrine 事件侦听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用在配置文件中注册的几个 Doctrine 侦听器进行一些自动更新(created_on、updated_on 时间戳等).目前我已经实现了额外的功能,需要在数据库中存储准备好的值以便于搜索.

                  I am using several Doctrine listeners registered in configuration file for some automatic updates (created_on, updated_on timestamps etc.). Currently I have implemented additional functionality that requires stashing prepared values in the database for easier searching.

                  我正在考虑使用 update Symfony 命令来准备这些值而不是 SQL 更新脚本(实际上,任何类型的更改或更新值的创建方式都不需要只运行这个命令).然而,这也会触发前面提到的 EventListeners.

                  I am thinking about update Symfony command that would prepare these values instead of SQL update script (actually any sort of change or update in the way the value is crated would than require just running this single command). However this would also trigger the EventListeners mentioned earlier.

                  有没有办法为单个命令禁用特定的 EventLister?

                  Is there a way how to disable particular EventLister for single Command?

                  推荐答案

                  这样的事情应该可以解决问题:

                  something like this should do the trick :

                  $searchedListener = null;
                  $em = $this->getDoctrine()->getManager();
                  foreach ($em->getEventManager()->getListeners() as $event => $listeners) {
                      foreach ($listeners as $key => $listener) {
                          if ($listener instanceof ListenerClassYouLookFor) {
                              $searchedListener = $listener;
                              break 2;
                          }
                      }
                  }
                  if ($searchedListener) {
                      $evm = $em->getEventManager();
                      $evm->removeEventListener(array('onFlush'), $searchedListener);
                  }
                  else { //listener not found
                  
                  }
                  

                  这篇关于Symfony 2:在 ContainerAwareCommand 中禁用 Doctrine 事件侦听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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. <tfoot id='NsqpT'></tfoot>

                          <tbody id='NsqpT'></tbody>

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

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

                      • <legend id='NsqpT'><style id='NsqpT'><dir id='NsqpT'><q id='NsqpT'></q></dir></style></legend>

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