예제 #1
0
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     $c = new Criteria();
     #$c->add(PoliticoPeer::ID, 18256, Criteria::EQUAL);
     $politicos = PoliticoPeer::doSelect($c);
     #echo SfVoUtil::myUcfirst("Casilda")."\n";die;
     foreach ($politicos as $politico) {
         $vanity = $politico->getVanity();
         $nombre = $politico->getNombre();
         $apellidos = $politico->getApellidos();
         if (strcmp($vanity, $newVanity = SfVoUtil::fixCase($vanity))) {
             echo "politico:{$vanity} -> {$newVanity}\n";
             $politico->setVanity($newVanity);
         }
         if ($nombre != ($newNombre = SfVoUtil::fixCase($nombre))) {
             echo "politico:{$nombre} -> {$newNombre}\n";
             $politico->setNombre($newNombre);
         }
         if ($apellidos != ($newApellidos = SfVoUtil::fixCase($apellidos))) {
             echo "politico:{$apellidos} -> {$newApellidos}\n";
             $politico->setApellidos($newApellidos);
         }
         $politico->save();
     }
     $instituciones = InstitucionI18nPeer::doSelect($c);
     foreach ($instituciones as $institucion) {
         $vanity = $institucion->getVanity();
         $nombreCorto = $institucion->getNombreCorto();
         $nombre = $institucion->getNombre();
         if (strcmp($vanity, $newVanity = SfVoUtil::fixCase($vanity))) {
             echo "institucion:{$vanity} -> {$newVanity}\n";
             $institucion->setVanity($newVanity);
         }
         if (strcmp($nombreCorto, $newNombreCorto = SfVoUtil::fixCase($nombreCorto))) {
             echo "institucion:{$nombreCorto} -> {$newNombreCorto}\n";
             $institucion->setNombreCorto($newNombreCorto);
         }
         if (strcmp($nombre, $newNombre = SfVoUtil::fixCase($nombre))) {
             echo "institucion:{$nombre} -> {$newNombre}\n";
             $institucion->setNombre($newNombre);
         }
         $institucion->save();
     }
     $geos = GeoPeer::doSelect($c);
     foreach ($geos as $geo) {
         $nombre = $geo->getNombre();
         if (strcmp($nombre, $newNombre = SfVoUtil::fixCase($nombre))) {
             echo "geo:{$nombre} -> {$newNombre}\n";
             $geo->setNombre($newNombre);
         }
         $geo->save();
     }
 }