Question

I have a SoapServer. This soap server has a class

$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.

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

The call being made is sendNotification. My question is: How can I inject my EntityManager of Doctrine in here? I can't find any method for this and I really hate using static calls for this.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top