addOptions(array( new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'zakaznik'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'), )); $this->namespace = ''; $this->name = 'oprav-dochazku'; $this->briefDescription = ''; $this->detailedDescription = ''; } protected function execute($arguments = array(), $options = array()) { $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection(); $hodiny = Doctrine::getTable('Kurz_hodina')->createQuery() ->addWhere('zruseno = ? OR zruseno = ?', array('pozde', 'agentura')) ->execute(); foreach($hodiny as $hodina) { foreach($hodina->getKurz_beh()->pracovnici() as $pracovnik) { if(!$dochazka = $hodina->getDochazkaByPracovnik($pracovnik)) { $this->logSection('Hodina', $hodina->getId().' | '.$hodina->getDatum().' | '.$hodina->getZruseno().' | '.$pracovnik->getName()); } } } } }