简体   繁体   English

PHP SoapServer,如何从类中访问我的实体管理器?

[英]PHP SoapServer, how can I access my entity manager from within the class?

I have a SoapServer. 我有一个SoapServer。 This soap server has a class 这个soap服务器有一个类

$server = new \SoapServer($this->wsdl_path, array('classmap' => $this->classmap));
$server->setClass('MyNamespace\\MyBundle\\Lib\\MySoapMethods');

And I have the class MySoapMethods which actually contain the methods being executed. 我有类MySoapMethods,它实际上包含正在执行的方法。

class MySoapMethods
{
  public function sendNotification(NotificationRequest $request) {}
}

The call being made is sendNotification. 正在进行的调用是sendNotification。 My question is: How can I inject my EntityManager of Doctrine in here? 我的问题是:如何在这里注入我的EnttrManager of Doctrine? I can't find any method for this and I really hate using static calls for this. 我找不到任何方法,我真的讨厌使用静态调用。

http://www.php.net/manual/en/soapserver.setclass.php http://www.php.net/manual/en/soapserver.setclass.php

You can specify more arguments to the setServer method which will be passed to the constructor of the called class. 您可以为setServer方法指定更多参数,这些参数将传递给被调用类的构造函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM