webchemistry/doctrine-extras

There is no license information available for the latest version (dev-master) of this package.

dev-master 2024-04-05 11:24 UTC

This package is auto-updated.

Last update: 2024-05-05 11:34:37 UTC


README

$factory = new BulkFactory($em);

// insert
$bulk = $factory->createInsert(Entity::class, ['id', 'firstName']);

$bulk->setReplace(true); // REPLACE INTO ...
$bulk->setSkipConflicts(true); // INSERT IGNORE ...
$bulk->setUpsert(true); // INSERT INTO ... ON DUPLICATE KEY UPDATE

$bulk->addValues([
    'id' => 1,
    'firstName' => 'Jane',
]);
$bulk->execute();

// update
$bulk = $factory->createUpdate(Entity::class, ['firstName'], ['id']); // updates only firstName, field id is in where clause
$bulk->addValues([
    'id' => 1,
    'firstName' => 'Jane',
]);
$bulk->execute();