Create a new Row using the
newRow() method. You can assign data using
properties, or pass an array of initial data to populate into the Row.
$threadRow = $atlas->newRow([ 'title' => 'New Thread Title', ]);
You can assign a value via a property, which maps to a column name.
$date = new \DateTime(); $threadRow->date_added = $date->format('Y-m-d H:i:s');
You can insert a single Row into the database by using the
The insertRow() method will not catch exceptions; you may wish to wrap the method call in a try/catch block.
Inserting a Row into a table with an auto-incrementing primary key will automatically modify the Row to set the last-inserted ID.
Updating an existing row works the same as
// fetch an existing row by primary key $threadRow = $threadTable->fetchRow(3); // modify the title $threadRow->title = 'This title is better than the last one'; // save the row back to the database $threadTable->updateRow($threadRow);
The updateRow() method will not catch exceptions; you may wish to wrap the method call in a try/catch block.
The updateRow() method will only send the row data changes back to the database, not the entire row. If there were no changes to the row data, calling updateRow() will be a no-op.
Deleting a row works the same as inserting or updating.
$threadRow = $threadTable->fetchRow(3); $threadTable->deleteRow($threadRow);
The deleteRow() method will not catch exceptions; you may wish to wrap the method call in a try/catch block.
deleteRow() operate on individual
Row objects, you can perform table-wide operations using
delete(). These latter three methods return Atlas.Query objects for you
to work with as you see fit; call
perform() on them directly to execute the
query and get back a PDOStatement.
See the Atlas.Query documentation for more information on the insert, update, and delete query objects.