Download the PHP package c24-toys/doctrine-bulk without Composer
On this page you can find all versions of the php package c24-toys/doctrine-bulk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download c24-toys/doctrine-bulk
More information about c24-toys/doctrine-bulk
Files in c24-toys/doctrine-bulk
Package doctrine-bulk
Short Description Simple classes that allows bulk operations on doctrine entities (only mySQL upsert supported)
License MIT
Informations about the package doctrine-bulk
Doctrine-Bulk Classes for MySQL
Adds ability to multiple upsert / insert on duplicate (MySQL only) of entities or array to database using doctrine schema and ORM objects.
INSERT ... ON DUPLICATE KEY UPDATE Statement for ORM objects
INSERT INTO t1 (a,b,c) VALUES (1,2,3)
ON DUPLICATE KEY UPDATE c=c+1;
https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html
Be warned: this function will just take your list of your ORM objects and will create the insert on duplicate sql query
- Supported Relationship / Join Types are ONE_TO_ONE AND MANY_TO_ONE
- LifeCycleCallbacks Events::prePersist / Events::preUpdate are supported
- Your ORM objects can be detached from session to avoid the insert/update triggered by ORM.. ** I opted to give you flexibility here, use $detach parameter
- Changes will be sent to DB in chunks
If the world would be nice and Doctrine able to do something else then single insert/update queries for MySQL, i would not need to do this.
Save the planet with less energy used for wasted queries :)
Samples
Default usage
Forked from https://github.com/6dreams/doctrine-bulk
All versions of doctrine-bulk with dependencies
doctrine/orm Version ^2.5
ext-pdo Version *
symfony/cache Version ^v5.4.0
doctrine/annotations Version ^1.13.2