php - How to create two controller with different table in zend 2 -


i want create 2 controller different tables fetch records view,edit , update them first album controller works fine when create controller gives me error.

enter image description here

you need register service album\model\demotable service manager; have existing album\model\albumtable.

the documentation shows how register albumtable;

so modifying example, should work:

 // module.php  public function getserviceconfig()  {      return array(          'factories' => array(              'album\model\demotable' =>  function($sm) {                  $tablegateway = $sm->get('demotablegateway');                  $table = new demotable($tablegateway);                  return $table;              },              'album\model\albumtable' =>  function($sm) {                  $tablegateway = $sm->get('albumtablegateway');                  $table = new albumtable($tablegateway);                  return $table;              },              'albumtablegateway' => function ($sm) {                  $dbadapter = $sm->get('zend\db\adapter\adapter');                  $resultsetprototype = new resultset();                  $resultsetprototype->setarrayobjectprototype(new album());                  return new tablegateway('album', $dbadapter, null, $resultsetprototype);              },             'demotablegateway' => function ($sm) {                  $dbadapter = $sm->get('zend\db\adapter\adapter');                  $resultsetprototype = new resultset();                  $resultsetprototype->setarrayobjectprototype(new demo());                  return new tablegateway('demo', $dbadapter, null, $resultsetprototype);              },          ),      );  } 

obviously need replace demo() class actual class table mapping to.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -