<commit_before><?php

class maintenanceCompteStatutTask extends sfBaseTask
{
  protected function configure()
  {
    // // add your own arguments here
    // $this->addArguments(array(
    //   new sfCommandArgument('my_arg', sfCommandArgument::REQUIRED, 'My argument'),
    // ));

    $this->addOptions(array(
      new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'),
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
      new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'default'),
      // add your own options here
    ));

    $this->namespace        = 'maintenance';
    $this->name             = 'compte-statut';
    $this->briefDescription = '';
    $this->detailedDescription = <<<EOF
The [maintenanceCompteStatut|INFO] task does things.
Call it with:

  [php symfony maintenanceCompteStatut|INFO]
EOF;
  }

  protected function execute($arguments = array(), $options = array())
  {
    // initialize the database connection
    $databaseManager = new sfDatabaseManager($this->configuration);
    $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
    
    $rows = CompteAllView::getInstance()->findByInterproVIEW('INTERPRO-declaration');

    foreach($rows as $row) {
      $compte = CompteClient::getInstance()->find($row->id);

      $societe = SocieteClient::getInstance()->find($compte->id_societe);

      $compte->add('statut', $societe->statut);

      $compte->save();

      echo $compte->_id."\n";
    }
  }
}<commit_msg>update de tout les ETB (y compris les suspendu et ceux qui n'ont pas d'interpro)<commit_after><?php

class maintenanceEtablissementUpdateTask extends sfBaseTask {

    protected function configure() {
        // // add your own arguments here
        // $this->addArguments(array(
        //   new sfCommandArgument('my_arg', sfCommandArgument::REQUIRED, 'My argument'),
        // ));

        $this->addOptions(array(
            new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name'),
            new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
            new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'default'),
                // add your own options here
        ));

        $this->namespace = 'maintenance';
        $this->name = 'etablissement-update';
        $this->briefDescription = '';
        $this->detailedDescription = <<<EOF
The [maintenanceEtablissementUpdateTask|INFO] task does things.
Call it with:

  [php symfony maintenanceEtablissementUpdateTask|INFO]
EOF;
    }

    protected function execute($arguments = array(), $options = array()) {
        // initialize the database connection
        $databaseManager = new sfDatabaseManager($this->configuration);
        $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
        
        $viewClient = EtablissementAllView::getInstance();
        $etablissementsView = $viewClient->getClient()->startkey()
                            ->endkey(array(array()))
			    ->reduce(false)
			    ->getView($viewClient->getDesign(), $viewClient->getView());

        foreach ($etablissementsView->rows as $etablissementView) {

            $etablissement = EtablissementClient::getInstance()->find($etablissementView->id);
            if (!$etablissement) {
                echo "L'établissement $etablissementView->id n'a pas été trouvé dans la base! \n";
            }
            echo $etablissement->_id." va être sauvé   >>>>>>>>>>>>  ";
            
            try {
                $etablissement->save();                
            } catch (Exception $exc) {
                echo $exc->getTraceAsString();
            }

            echo $etablissement->_id . " $etablissement->statut saved! \n";
        }
    }

}
{'fraction_non_alphanumeric': 0.137621540762902, 'fraction_numerical': 0.0, 'mean_word_length': 3.0281124497991967, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 58, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5649954', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1095, 'n_words': 234}