public function insertValues(ExcelInputFile $excelInputFile, $subgroup, $origin, $destiny, $type, $variety, $font, $typeCountry = null, $internationalTrade = false)
 {
     $countries = $excelInputFile->getValuesOfColumn(1);
     $dataToSave = new ArrayObject();
     foreach ($countries as $country) {
         if ($typeCountry == 'origin') {
             $origin = CacheCountry::getCountries()->getOrigins()->get(utf8_encode($country))->id();
             if (is_null($origin)) {
                 $origin = $this->countryMap->getOuthersForOrigin();
             }
             if (!$internationalTrade) {
                 $destiny = 0;
             }
         } elseif ($typeCountry == 'destiny') {
             $destiny = CacheCountry::getCountries()->getDestinies()->get(utf8_encode($country))->id();
             if (is_null($destiny)) {
                 $destiny = $this->countryMap->getOthersForDestiny();
             }
             if (!$internationalTrade) {
                 $origin = 0;
             }
         } else {
             $origin = CacheCountry::getCountries()->getOrigins()->get(utf8_encode($country))->id();
         }
         $dataParam = new DataParam($subgroup, $font, $type, $variety, $origin, $destiny);
         $dataOfCurrentCountry = $this->getValuesWithSimpleFilter($dataParam);
         $yearsToInsert = $this->insertValuesIfACountryDoesNotHaveItStoredYet($dataOfCurrentCountry, $excelInputFile, $country);
         if ($yearsToInsert->count() > 0) {
             $this->getDataToSave($dataToSave, $yearsToInsert, $excelInputFile, $country, $subgroup, $font, $type, $variety, $origin, $destiny);
         }
     }
     return $this->repository->save($dataToSave);
 }
/**
 *
 * @param type $jsonResponse
 * @return DatacenterController 
 */
function requires($jsonResponse){
    require_once 'requires_build.php';
    $repository = new DatacenterDao(Connection::connect());

    CacheCountry::setCacheBehavior(SessionAdmin::getCacheBehavior());
    $cache = CacheCountry::getCountries();

    $service = new DatacenterService($repository, $cache);//$countryMap);
    $statistic = new Statistic();
    $grouper = new DataGrouper();
    $controller = new DatacenterController($service, $statistic, $jsonResponse, $grouper, $factory);     
    return $controller;
}
<?
    require_once 'AdminLogin.php';

    $loginController = new AdminLogin();
    CacheCountry::setCacheBehavior(SessionAdmin::getCacheBehavior());
    CacheCountry::destroyCache();
    $loginController->logout(SessionAdmin::getLoggedUser());
   
?>
 public static function setCacheBehavior(CacheBehavior $cache)
 {
     self::$cache = $cache;
 }
 if ($variety == "none") {
     $variety = 0;
 }
 $destiny = $_POST['destiny'];
 $origin = $_POST['origin'];
 $typeCountry = null;
 if (isset($_POST['typeCountry'])) {
     $typeCountry = $_POST['typeCountry'];
 }
 if (!insertingValuesForInternationalTrade($subgroup)) {
     $destiny = 0;
     $origin = 0;
 }
 $repository = new DatacenterDao(Connection::connect());
 CacheCountry::setCacheBehavior(SessionAdmin::getCacheBehavior());
 $cache = CacheCountry::getCountries();
 $service = new DatacenterService($repository, $cache);
 //$countryMap);
 $statistic = new Statistic();
 $grouper = new DataGrouper();
 $controller = new DatacenterController($service, $statistic, $jsonResponse, $grouper, $factory);
 $reader = new Spreadsheet_Excel_Reader($_FILES['Planilha']['tmp_name']);
 try {
     $inputFile = new ExcelInputFile($reader);
     if (insertingValuesForInternationalTrade($subgroup)) {
         //$typeCountry = 'origin';
         $response = $controller->saveValues($inputFile, $subgroup, $font, $origin, $destiny, $coffeType, $variety, $typeCountry, true);
     } else {
         $response = $controller->saveValues($inputFile, $subgroup, $font, $origin, $destiny, $coffeType, $variety, $typeCountry);
     }
     print_r($response);
function cacheCountry(Country $countryToCache, $type){
 CacheCountry::setCacheBehavior(SessionAdmin::getCacheBehavior());
 CacheCountry::addCountry($countryToCache, $type);
}
<?  
require_once '../core/Datacenter/CountryMap.php';
require_once '../core/generics/GenericDao.php';
require_once '../core/generics/Param.php';
require_once '../core/generics/datacenter/Country.php';
require_once '../core/generics/Controller.php';
//require_once '../core/Datacenter/cache/cache_countries.php'; 
?>
<h2>
    Administrador do Datacenter
</h2>
<h3>
    <?CacheCountry::setCacheBehavior(SessionAdmin::getCacheBehavior());?>
    <?CacheCountry::cacheCountries();?>
    <?//print_r(CacheCountry::getCountries());?>
</h3>

<div class="inside-item-admin">
    <ul>
        <li>
            <a href="<?echo $baseUrl?>/admin/datacenter/paises">Inserir País</a>
        </li>
        <li>
            <a href="<?echo $baseUrl?>/admin/datacenter/paises/origem">Listar Países de Origem</a>
        </li>
        <li>
            <a href="<?echo $baseUrl?>/admin/datacenter/paises/destino">Listar Países de Destino</a>
        </li>
        <li>
            <a href="<?echo $baseUrl?>/admin/datacenter/list">Listar Dados</a>
        </li>
 private function destinyCountries()
 {
     //$countries = array("EUA", "França", "Franca", "Alemanha", "Canadá", "Canada", "Itália", "Italia", "Japão", "Japao", "Outros");
     $countries = CacheCountry::getCountries()->getDestinies()->keys();
     foreach ($countries as $i => $country) {
         $countries[$i] = utf8_decode($country);
     }
     return $countries;
 }