/** * Inserts new data record to database * * @param \Dive\Table $table * @param array $data * @return string */ protected static function insertDataset(Table $table, array $data) { $conn = $table->getConnection(); $affectedRows = $conn->insert($table, $data); return $affectedRows == 1 ? $conn->getLastInsertId() : false; }
/** * Clear dataset ids by given table * * @param \Dive\Table $table */ public function clearByTable(Table $table) { $connIndex = $this->getConnectionIndex($table->getConnection()); if ($connIndex === false) { return; } $tableName = $table->getTableName(); unset($this->tables[$connIndex][$tableName]); unset($this->registry[$connIndex][$tableName]); }