addOptions(array( new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'frontend'), new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'), new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine'), )); $this->namespace = ''; $this->name = 'importUsers'; $this->briefDescription = ''; $this->detailedDescription = ''; } protected function execute($arguments = array(), $options = array()) { $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'])->getConnection(); foreach(file(self::FILE) as $i => $row) { if($i > 0) { list($title, $first_name, $last_name, $street, $city, $zip, $code) = explode(self::DELEMITER, $row); if(!empty($title)) { $user = new User(); $user->setTitle($title); $user->setFirstName($first_name); $user->setLastName($last_name); $user->setStreet($street); $user->setCity($city); $user->setZip($zip); $user->setCode(trim($code)); $user->save(); $this->logSection('user+', $user->getName()); } } } } }