Skip to content
DaSpors edited this page Nov 2, 2020 · 5 revisions

DBAL

The database abstraction layer follows a simple DB-first pattern.
It is in fact a ORM with a high level API, that allows you to query most data in a one-liner or at least create 'typed' Queries that result in Object lists.

Basic classes

There are two basic classes you found be familiar with:

The DBAL will create properties according to the table definitions found in the database.
This can be as simple as this:

$data = DataSource::Get()->Query('mytable')->like('name','%peter%');
foreach( $data as $entry )
{
	// do something
	echo "{$data->id}: {$data->name}\n";
}

In this sample the DBAL will create a ResultSet ($data) containing objects of type CommonModel, each with properties for each table column.

Clone this wiki locally