addOptions(array( new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'prod'), )); $this->namespace = 'import'; $this->name = 'import3'; $this->briefDescription = 'Doplneni informaci o testu k uchazecum'; } protected function execute($arguments = array(), $options = array()) { $configHandler = new sfDatabaseConfigHandler(); $databases = $configHandler->evaluate(array($this->configuration->getRootDir().'/config/databases.yml')); $counter = 0; $uchazecArr = Doctrine::getTable('Uchazec') ->createQuery() ->where('(LENGTH(test_nazev) = 0 OR test_nazev IS NULL)') ->andWhere('pracovnik_id IS NOT NULL') ->execute(); foreach($uchazecArr AS $uchazec) { $uchazec->test_nazev = $uchazec->Test_zakaznik->Test->nazev_testu; $uchazec->test_cas = $uchazec->Test_zakaznik->Test->cas; $uchazec->test_instrukce = $uchazec->Test_zakaznik->Test->instrukce; $uchazec->test_kriteria = $uchazec->Test_zakaznik->Test->kriteria; $uchazec->save(); ++$counter; } echo "\n\n{$counter}\n"; } }