Example #1
0
 public static function saveNewFilesFromCollection(UploadsCollection $collection)
 {
     $toInsert = [];
     $command = \yii::$app->db->createCommand();
     foreach ($collection->getNewFiles() as $file) {
         $file->save();
         $toInsert[] = [$collection->id, (string) $file];
     }
     return $command->batchInsert(self::TABLE_NAME, ['collection_id', 'filepath'], $toInsert)->execute();
 }