/**
  * @see sfTask
  */
 public function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $conn = $databaseManager->getDatabase('propel')->getConnection();
     $tables = array('information_object' => 'QubitInformationObject', 'actor' => 'QubitActor', 'term' => 'QubitTerm');
     foreach ($tables as $table => $classname) {
         $this->logSection('propel', 'Build nested set for ' . $table . '...');
         $sql = 'SELECT id, parent_id';
         $sql .= ' FROM ' . constant($classname . '::TABLE_NAME');
         $sql .= ' ORDER BY parent_id ASC, lft ASC';
         $tree = $children = array();
         foreach ($conn->query($sql, PDO::FETCH_ASSOC) as $item) {
             // Add root node to tree
             if (constant($classname . '::ROOT_ID') == $item['id']) {
                 array_push($tree, array('id' => $item['id'], 'lft' => 1, 'rgt' => null, 'children' => array()));
             } else {
                 // build hash of child rows keyed on parent_id
                 if (isset($children[$item['parent_id']])) {
                     array_push($children[$item['parent_id']], $item['id']);
                 } else {
                     $children[$item['parent_id']] = array($item['id']);
                 }
             }
         }
         // Recursively add child nodes
         self::addChildren($tree[0], $children, 1);
         // Crawl tree and build sql statement to update nested set columns
         $rows = self::getNsUpdateRows($tree[0], $classname);
         // Update database
         $conn->beginTransaction();
         try {
             // There seems to be some limit on how many rows we can update with one
             // exec() statement, so chunk the update rows
             $incr = 4000;
             for ($i = 0; $i <= count($rows); $i += $incr) {
                 $sql = implode("\n", array_slice($rows, $i, $incr));
                 $conn->exec($sql);
             }
         } catch (PDOException $e) {
             $conn->rollback();
             throw sfException($e);
         }
         $conn->commit();
     }
     // endforeach
     $this->logSection('propel', 'Done!');
 }
 public function doClean($values)
 {
     if (!isset($values['email'])) {
         throw sfException('Error');
     }
     $user = Doctrine::getTable('sfAuthUser')->findOneByEmail($values['email']);
     if ($user) {
         if ($user->getResetHash() && time() < $user->getResetHashCreatedAt() + 86400) {
             throw new sfValidatorError($this, 'You have requested a password less than 24 hours ago');
         }
         $user->setResetHash(sfAuthUtil::getHashedPasswordBySaltAndString(time(), uniqid()));
         $user->setResetHashCreatedAt(time());
         $user->save();
         return array_merge($values, array('user' => $user));
     }
     //Throw user cant be found
     throw new sfValidatorError($this, 'User not found');
 }