/** * Sets the primary table name and retrieves the table schema. * * @param \Micro\Database\Table\TableAbstract $adapter * @return \Micro\Database\Select This \Micro\Database\Select object. */ public function setTable(TableAbstract $table) { $this->_adapter = $table->getAdapter(); $this->_info = $table->info(); $this->_table = $table; return $this; }
public function rollback() { if (self::$transactionLevel === 1) { $db = $this->table->getAdapter(); if ($db) { $db->rollBack(); } } self::$transactionLevel--; }
/** * @param string $tableName * @param TableAbstract $referenceTable * @throws \Exception * @return \Micro\Database\Table\TableAbstract */ public static function getTableFromString($tableName, TableAbstract $referenceTable = null) { // assume the tableName is the class name if (!class_exists($tableName)) { throw new Exception("Class '{$tableName}' does not exists"); } $options = array(); if ($referenceTable instanceof TableAbstract) { $options['db'] = $referenceTable->getAdapter(); } return new $tableName($options); }