/** * Sets the primary table name and retrieves the table schema. * * @param AbstractTable $adapter * @return \libDb\Select This \libDb\Select object. */ public function setTable(AbstractTable $table) { $this->_adapter = $table->getAdapter(); $this->_info = $table->info(); $this->_table = $table; return $this; }
public static function getTableFromString($tableName, \libDb\Table\AbstractTable $referenceTable = null) { if ($referenceTable instanceof \libDb\Table\AbstractTable) { $tableDefinition = $referenceTable->getDefinition(); if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) { return new \libDb\Table($tableName, $tableDefinition); } } $options = array(); if ($referenceTable instanceof \libDb\Table\AbstractTable) { $options['db'] = $referenceTable->getAdapter(); } if (isset($tableDefinition) && $tableDefinition !== null) { $options[\libDb\Table\AbstractTable::DEFINITION] = $tableDefinition; } return new $tableName($options); }