/**
  * Export a zip for the provided units.
  *
  * @param $units
  *
  * @return ZipArchive
  */
 protected function getZipFromUnit($units)
 {
     $exporter = new ZipExporter();
     $exporter->setUnits($units);
     $zipPath = $exporter->createZipFile();
     $zip = new ZipArchive();
     $zip->open($zipPath);
     return $zip;
 }
 protected function createZip()
 {
     // Then we create the zip
     $unit1 = new Unit('functional', 'key1');
     $unit1->setTranslation('en', 'value1');
     $unit1->setTranslation('fr', 'value_fr');
     $unit2 = new Unit('functional', 'key2');
     $unit2->setTranslation('en', 'new_value2');
     $unit2->setTranslation('fr', 'value2_fr');
     $unit3 = new Unit('functional', 'compound.translation2');
     $unit3->setTranslation('en', 'compound 2 en');
     $unit3->setTranslation('fr', 'compound 2 fr');
     $unit4 = new Unit('functional', 'compound.translation1');
     $unit4->setTranslation('en', 'new compound 2 en');
     $exporter = new ZipExporter();
     $exporter->setUnits(array($unit1, $unit2, $unit3, $unit4));
     return new UploadedFile($exporter->createZipFile(sys_get_temp_dir() . '/trans.zip'), 'trans.zip');
 }