Download the PHP package hgato/php-crud-comparator without Composer
On this page you can find all versions of the php package hgato/php-crud-comparator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download hgato/php-crud-comparator
More information about hgato/php-crud-comparator
Files in hgato/php-crud-comparator
Download hgato/php-crud-comparator
More information about hgato/php-crud-comparator
Files in hgato/php-crud-comparator
Vendor hgato
Package php-crud-comparator
Short Description Library to compare PHP model arrays
License MIT
Package php-crud-comparator
Short Description Library to compare PHP model arrays
License MIT
Please rate this library. Is it a good library?
Informations about the package php-crud-comparator
CRUD Comparator
This library is meant to compare arrays of models and return 3 arrays: to create, to update, to delete.
Logic of execution is following:
- array of old models is provided as a first argument
- array of new models is provided as a second argument
- array of id fields is provided as the third argument
- array of secondary fields is provided as fourth argument
- if the model with same ids (all id fields treated as combined key) exists in both old and new array but secondary fields are different - model is treated as one for update
- if the model with same ids exists in both old and new array and secondary fields are same - model is ignored
- if model is in old array but not in new - model is meant to be deleted
- im model vice versa in noe, but not in old - model is meant for creation
Typical use case: frontend sends an array of models, but doesn't say what have changed. Simultaneously some data is in database already. This library helps to fund difference.
Example
All versions of php-crud-comparator with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.0.33
The package hgato/php-crud-comparator contains the following files
Loading the files please wait ....