This repo is READ ONLY, in order to contribute to Flow PHP project, please open PR against flow monorepo.
Changes merged to monorepo are automatically propagated into sub repositories.
Doctrine Bulk is missing bulk upsert/insert abstraction for Doctrine DBAL.
composer require flow-php/doctrine-dbal-bulk:1.x@dev
Insert:
$bulk = Bulk::create();
$bulk->insert(
$dbalConnection,
'your-table-name',
new BulkData([
['id' => 1, 'name' => 'Name One', 'description' => 'Description One'],
['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two'],
['id' => 3, 'name' => 'Name Three', 'description' => 'Description Three'],
])
);
Update:
$bulk = Bulk::create();
$bulk->update(
$dbalConnection,
'your-table-name',
new BulkData([
['id' => 1, 'name' => 'Name One', 'description' => 'Description One'],
['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two'],
['id' => 3, 'name' => 'Name Three', 'description' => 'Description Three'],
]),
[
'primary_key_columns' => ['id'],
'update_columns' => ['name']
]
);
- PostgreSQL
Dialect is basic abstraction of this library.
The main role of Dialect is to prepare SQL insert/update statement based on BulkData
and provided options
.
$insertOptions
$updateOptions
Options are key => value maps without predefined structure that allows to manipulate building SQL statement. Each dialect should define it own structure for options in order to support db engine features, including those that are specific for given engine.
QueryFactory is abstraction for creating queries, there is currently only one
implementation, DbalPlatform. QueryFactory insertOptions
and updateOptions
is combination of all options provided
by supported Dialects where each entry must be optional.
example:
dialect_option?: string
DbalPlatform is a factory that detects which Dialect should be used for given Doctrine DBAL Platform.