【发布时间】:2014-05-02 10:38:41
【问题描述】:
我在 symfony2 中遇到了原生 php SoapServer 的问题。 SoapServer 使用 symfony2 中的“UserService”服务类,应该使用注入的 symfony2 EntityManager 对其进行实例化,以便我可以访问我的“UserRepository”。
澄清一下:
肥皂服务器:
$oSOAPServer = new \SoapServer('/path/to/wsdl');
$oSOAPServer->setClass("my\Namespace\UserService");
$oSOAPServer->handle();
服务:
use \Doctrine\ORM\EntityManager as EntityManager;
class UserService
{
protected $em;
public function __construct(EntityManager $em) {
$this->em = $em;
}
...
问题是:SoapServer 总是返回一个内部服务器错误。 服务本身直接在 symfony2 中调用。 是否可以在被 SoapServer 调用/实例化时注入 EntityManager?
提前致谢!
马丁
【问题讨论】:
标签: php symfony soap code-injection soapserver