Example #1
0
 public static function getCrossVersionDiffData()
 {
     $result = [];
     //берем две последние версии
     $versions = self::getLast2Versions();
     if (count($versions) == 2) {
         $modelPrev = JsonHistory::find()->where(['version' => $versions[0]])->orderBy('id DESC')->one();
         $modelCurrent = JsonHistory::find()->where(['version' => $versions[1]])->orderBy('id DESC')->one();
         if ($modelPrev && $modelCurrent) {
             $result = JsonSchemaDiff::diff(json_decode($modelPrev->content, 1), json_decode($modelCurrent->content, 1));
         }
     }
     return $result;
 }
Example #2
0
 public function getDiff()
 {
     $versions = $this->load()->getVersions();
     $data = [];
     foreach ($versions as $version) {
         $data[$version] = $this->load($version)->getContent();
     }
     return JsonSchemaDiff::diff($data[8], $data[9]);
 }