/** * Retrieve TableGateway * * @param string $table * @return TableGateway */ protected function getTable($table) { $sm = $this->getServiceManager(); $dbAdapter = $sm->get('DbAdapter'); $tableGateway = new TableGateway($dbAdapter, $table, new $table()); $tableGateway->initialize(); return $tableGateway; }
/** * Retrieve TableGateway * * @param string $table * @return TableGateway */ protected function getTable($table) { $sm = $this->serviceManager; $dbAdapter = $sm->get('DbAdapter'); $tableGateway = new TableGateway($dbAdapter); $object = new $table(); $tableGateway->initialize($object->getTableName(), $object); return $tableGateway; }