Example #1
0
 public static function checkRecords($oldVersion, $newVersion)
 {
     parent::checkRecords($oldVersion, $newVersion);
     if ($newVersion == 2) {
         foreach (Gallery::find() as $gallery) {
             $i = 0;
             foreach (Image::find(new Equals('GalleryID', $gallery->GalleryID)) as $image) {
                 $image->Order = $i++;
                 $image->save();
             }
         }
     }
 }