This package is installable and autoloadable via Composer
as atlas/table. Add the following lines
to your composer.json
file, then call composer update
.
{
"require": {
"atlas/table": "~1.0"
}
}
Before using Atlas.Table, you will need to create the prerequsite data-source classes using the skeleton generator.
Once you have your data source classes in place, create a TableLocator using
the static new()
method and pass your PDO connection parameters:
use Atlas\Table\TableLocator;
$tableLocator = TableLocator::new('sqlite::memory:');
Tip:
Alternatively, you can pass an already-created Atlas.Pdo Connection object.
You can then use the locator to retrieve a Table by its class name.
use Atlas\Testing\DataSource\Thread\ThreadTable;
$threadTable = $tableLocator->get(ThreadTable::CLASS);
From there you can select, insert, update, and delete Row objects on a table, or work with table-level query objects.