 <p><code>getServicelocator()</code> makes error. So it needs alternative way. And extends <code>AbstractTableGateway</code> or <code>ServiceLocatorAwareInterface</code> have errors.</p> <p>Factory implementation will help Controller to get objects.</p> <p>*User sample code will be similar to album.</p> <p>1) factory class ( RegisterControllerFactory.php) * copied function createUser in controller</p> <pre><code>namespace Users\Controller\Factory; use Users\Controller\RegisterController; use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; use Zend\ServiceManager\Exception\ServiceNotCreatedException; class RegisterControllerFactory { public function __invoke($serviceLocator) { $sm = $serviceLocator; $dbAdapter = $sm-&gt;get('Zend\Db\Adapter\Adapter'); $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet(); $resultSetPrototype-&gt;setArrayObjectPrototype(new \Users\Model\User); $tableGateway = new \Zend\Db\TableGateway\TableGateway('user' /* table name */, $dbAdapter, null, $resultSetPrototype); $user = new \Users\Model\User(); $userTable = new \Users\Model\UserTable($tableGateway); $controller = new RegisterController($userTable, $serviceLocator ); return $controller; } } </code></pre> <p>2) controller( RegisterController ) namespace Users\Controller;</p> <pre><code>use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; use Users\Form\RegisterForm; use Users\Form\RegisterFilter; use Users\Model\User; use Users\Model\UserTable; use Zend\ServiceManager\ServiceLocatorInterface; class RegisterController extends AbstractActionController { protected $userTable; protected $serviceManager; public function __construct(UserTable $userTable, ServiceLocatorInterface $serviceManager) { $this-&gt;userTable = $userTable; $this-&gt;serviceManager = $serviceManager; } public function indexAction() { $form = new RegisterForm(); $viewModel = new ViewModel(array('form' =&gt; $form)); return $viewModel; } public function processAction() { if (!$this-&gt;request-&gt;isPost()) { return $this-&gt;redirect()-&gt;toRoute(NULL , array( 'controller' =&gt; 'register', 'action' =&gt; 'index' )); } $post = $this-&gt;request-&gt;getPost(); $form = new RegisterForm(); $inputFilter = new RegisterFilter(); $form-&gt;setInputFilter($inputFilter); $form-&gt;setData($post); if (!$form-&gt;isValid()) { $model = new ViewModel(array( 'error' =&gt; true, 'form' =&gt; $form, )); $model-&gt;setTemplate('users/register/index'); return $model; } // Create user $this-&gt;createUser($form-&gt;getData()); return $this-&gt;redirect()-&gt;toRoute(NULL , array( 'controller' =&gt; 'register', 'action' =&gt; 'confirm' )); } public function confirmAction() { $viewModel = new ViewModel(); return $viewModel; } protected function createUser(array $data) { /*able to delete or modify */ $sm = $this-&gt;serviceManager; $dbAdapter = $sm-&gt;get('Zend\Db\Adapter\Adapter'); $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet(); $resultSetPrototype-&gt;setArrayObjectPrototype(new \Users\Model\User); $tableGateway = new \Zend\Db\TableGateway\TableGateway('user' /* table name */, $dbAdapter, null, $resultSetPrototype); $user = new User(); $user-&gt;exchangeArray($data); $userTable = new UserTable($tableGateway); $userTable-&gt;saveUser($user); return true; } } </code></pre> <p>3) module.config.php</p> <pre><code>return array( 'controllers' =&gt; array( 'invokables' =&gt; array( 'Users\Controller\Index' =&gt; 'Users\Controller\IndexController', 'Users\Controller\login' =&gt; 'Users\Controller\LoginController', //delete 'Users\Controller\Register' ), 'factories' =&gt; array( 'Users\Controller\Register' =&gt; 'Users\Controller\Factory\RegisterControllerFactory', ), ), </code></pre>