- used to Compare properties form the same objects using @PropertyTracker annotation return isChanged (true/false) and changedList if exist.
- We build CompareEngineTracker to suitable all php apps that need to keep track changing that happened to two objects (model, entities, documents ...etc).
- Via Composer
$ composer require ayman-mahgoub/Compare-engine-tracker
- add @propertyTracker annotation above your object property
/**
*@propertyTracker
*/
private $name;
- pass the two models to compareEngineTracker.
$reader = new AnnotationReader();
$compareEngine = new CompareEngineTracker($reader);
$result = $compareEngine->compare($oldObject, $newObject);
- result will contain isChanged index hold if the new object is changed or not and changedList index hold every property oldVal and newVal.
$ composer test
- For now compare works only for two object form the same type.
- Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
-
Ayman Mahgoub - Initial work - aymanMahgoub
-
See also the list of contributors who participated in this project.
- This project is licensed under the MIT License - see the LICENSE.md file for details