title: Zend Framework 2 call TableGateway in Service
body: <p>I'm new to ZF2. After few days of trying to figure out how all this stuff should work I was unable to figure out how should I call TableGateway Model from Service.</p>
  
  <p>So I have Controller:</p>
  
  <pre><code>class SubscriberController extends AbstractActionController
  {
  /**
   * @var \Subscriber\Service\SubscriberServiceInterface
   */
  private $subscriberService;
  
  /**
   * @param $subscriberService
   */
  public function __construct(SubscriberServiceInterface $subscriberService)
  {
      $this-&gt;subscriberService = $subscriberService;
  }
  </code></pre>
  
  <p>Factroy for this Controller:</p>
  
  <pre><code>class SubscriberControllerFactory implements FactoryInterface
  {
  /**
   * Returns ArchiveController instance.
   *
   * @param ServiceLocatorInterface $serviceLocator
   * @return SubscriberController
   * @override
   **/
  public function createService(ServiceLocatorInterface $serviceLocator)
  {
      $sm = $serviceLocator-&gt;getServiceLocator();
  
      return new SubscriberController(
          $sm-&gt;get('Subscriber\Service\SubscriberServiceInterface')
      );
  }
  </code></pre>
  
  <p>Some SubscriberTable:</p>
  
  <pre><code>class SubscriberTable
  {
  protected $tableGateway;
  
  public function __construct(TableGateway $tableGateway)
  {
      $this-&gt;tableGateway = $tableGateway;
  }
  
  public function fetchAll()
  {
      $resultSet = $this-&gt;tableGateway-&gt;select();
      return $resultSet;
  }
  </code></pre>
  
  <p>And Service in which I want to get SubscriberTable instance and make some logic. But I can't figure out how should I call this instance in SubscriberService and set the DbAdapter for SubscriberTable</p>