Yes, you can get the query like:
$request = $this->getServiceManager()->get('Request');
$query = $request->getQuery();
More detailed example:
<?php
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface;
class SomeService implements ServiceManagerAwareInterface
{
protected $serviceManager;
public function getServiceManager()
{
return $this->serviceManager;
}
public function setServiceManager(ServiceManager $serviceManager)
{
$this->serviceManager = $serviceManager;
return $this;
}
public function doSomething()
{
$request = $this->getServiceManager()->get('Request');
$query = $request->getQuery();
// as well as:
$params = $this->getServiceManager()->get('ControllerPluginManager')->get('params');
}
}