how to access service manager?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to access service manager?

charlie park
This post has NOT been accepted by the mailing list yet.
hi.

i must have to build soap server.

$soap = new \Zend\Soap\Server('server.wsdl');
$soap->setClass('server\Service\serviceGateway');

serviceGateway class is normal class and have 'process()' function.
i make db table class  reference to sample 'Album' and set serviceConfig like 'Album'.

how can i access db table from servcieGateway class?

// serviceGateway.php

public function process()
{
    $sm = Zend\Mvc\Application::getServiceManager();            <----------- x
    if($sm){
        $dbTable = $sm->get('server\Service\serviceGateway');
        .........

    }

}


best regards,
charlie.

Reply | Threaded
Open this post in threaded view
|

Re: how to access service manager?

EHaskins
This post has NOT been accepted by the mailing list yet.
Are you using the full MVC or are you building around certain parts of Zend Framework

if your class implements ServiceManagerAwareInterface

class Settings implements ServiceManagerAwareInterface

then it is as easy as going

public function loadSettings(){
        $sm = $this->getServiceManager();
        $sites = $sm->get('Application\Model\Sites');
}

Im a bit lost on what your doing so I apologize if I misunderstood

Eric