title: ZF2 I cant access my module modle table in another controller
body: <p>This is my first class      </p>
  
  <pre><code>&lt;?php 
  
  namespace Config\Controller;
  
  use Zend\Mvc\Controller\AbstractActionController;
  use Zend\View\Model\ViewModel;
  use Config\Model\Config;
  use Config\Form\ConfigForm;
  
  class ConfigController extends AbstractActionController
  { 
  protected $configTable;
  
  
  
  public function indexAction()
  {
      $this-&gt;getSMTPConfigTable();
      return new ViewModel(array(
              'config' =&gt; $this-&gt;getConfigTable()-&gt;fetchAll(),
      ));
  
  }
  
  public function addAction()
  {
      $form = new ConfigForm();
      $form-&gt;get('submit')-&gt;setValue('Add');
  
      $request = $this-&gt;getRequest();
      if ($request-&gt;isPost()) {
          $config = new Config();
          $form-&gt;setInputFilter($config-&gt;getInputFilter());
          $form-&gt;setData($request-&gt;getPost());
  
          if ($form-&gt;isValid()) {
              $config-&gt;exchangeArray($form-&gt;getData());
              $this-&gt;getConfigTable()-&gt;saveConfig($config);
  
              return $this-&gt;redirect()-&gt;toRoute('zfcadmin/config');
          }
      }
      return array('form' =&gt; $form);
  }
  
  public function editAction()
  {
      $id = (int) $this-&gt;params()-&gt;fromRoute('id', 0);
      if (!$id) {
          return $this-&gt;redirect()-&gt;toRoute('zfcadmin/config', array(
                  'action' =&gt; 'add'
          ));
      }
  
      try {
          $config = $this-&gt;getConfigTable()-&gt;getConfig($id);
      }
      catch (\Exception $ex) {
          return $this-&gt;redirect()-&gt;toRoute('zfcadmin/config', array(
                  'action' =&gt; 'index'
          ));
      }
  
      $form  = new ConfigForm();
      $form-&gt;bind($config);
      $form-&gt;get('submit')-&gt;setAttribute('value', 'Edit');
  
      $request = $this-&gt;getRequest();
      if ($request-&gt;isPost()) {
          $form-&gt;setInputFilter($config-&gt;getInputFilter());
          $form-&gt;setData($request-&gt;getPost());
  
          if ($form-&gt;isValid()) {
              $this-&gt;getConfigTable()-&gt;saveConfig($form-&gt;getData());
  
              return $this-&gt;redirect()-&gt;toRoute('zfcadmin/config');
          }
      }
  
      return array(
              'id' =&gt; $id,
              'form' =&gt; $form,
      );
  }
  
  public function getConfigTable()
  {
      if (!$this-&gt;configTable) {
          $sm = $this-&gt;getServiceLocator();
          $this-&gt;configTable = $sm-&gt;get('Config\Model\ConfigTable');
      }
      return $this-&gt;configTable;
  }
  
  public function getSMTPConfigTable()
  {
      $pr=$this-&gt;getConfigTable()-&gt;fetchAll();
      return $pr;
  }
  
      }
  </code></pre>
  
  <p>in another module class how am I do it? I have trying most ways but I am failing please help me.(sorry for my English )
  I need $temp=new ConfigController();
  $temp->getSMTPConfigTable();</p>