/** * _getTableFromString * * @param string $tableName * @return \Zend\DB\Table\AbstractTable */ protected function _getTableFromString($tableName) { if ($this->_table instanceof Table\AbstractTable) { $tableDefinition = $this->_table->getDefinition(); if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) { return new \Zend\DB\Table\Table($tableName, $tableDefinition); } } // // assume the tableName is the class name // if (!class_exists($tableName)) { // try { // end\Loader::loadClass($tableName); // } catch (end\Exception $e) { // throw new Exception($e->getMessage(), $e->getCode(), $e); // } // } $options = array(); if ($table = $this->_getTable()) { $options['db'] = $table->getAdapter(); } if (isset($tableDefinition) && $tableDefinition !== null) { $options[Table\AbstractTable::DEFINITION] = $tableDefinition; } if (class_exists($tableName, true) == false) { throw new Exception('Class ' . $tableName . ' not found'); } return new $tableName($options); }
/** * _getTableFromString * * @param string $tableName * @return \Zend\Db\Table\AbstractTable */ protected function _getTableFromString($tableName) { if ($this->_table instanceof AbstractTable) { $tableDefinition = $this->_table->getDefinition(); if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) { return new \Zend\Db\Table\Table($tableName, $tableDefinition); } } // assume the tableName is the class name if (!class_exists($tableName)) { throw new RowException('Unable to find table class by name "' . $tableName . '"'); } $options = array(); if ($table = $this->_getTable()) { $options['db'] = $table->getAdapter(); } if (isset($tableDefinition) && $tableDefinition !== null) { $options[AbstractTable::DEFINITION] = $tableDefinition; } return new $tableName($options); }