protected function execute($arguments = array(), $options = array())
  {
    $databaseManager = new sfDatabaseManager($this->configuration);
    $this->conn = $databaseManager->getDatabase('doctrine')->getDoctrineConnection();

    $sql = 'SELECT id FROM community';
    $where = array();
    if ( $options['cmin'] && $options['cmax']  && $options['cmin'] <= $options['cmax'])
    {
        $sql .= ' WHERE id BETWEEN ? AND ?';
        $where = array(intval($options['cmin']),intval($options['cmax']));
    }
    $commuIds = $this->conn->fetchColumn($sql, $where);
    foreach ($commuIds as $cid)
    {
      for ($i=0; $i < $options['number']; ++$i)
      {
        $ct = new CommunityEvent();
        $ct->setCommunityId($cid);
        $ct->setMemberId(self::fetchRandomMemberId($cid));
        $ct->setName('name');
        $ct->setBody('body');
        $ct->save();
        $ct->free();
        $this->logSection('created a community event', sprintf("%s", $cid));
      }
    }
  }
 public function insert(SimpleXMLElement $xml)
 {
     $member = Doctrine::getTable('Member')->find($this->getMemberIdByUrl((string) $xml->author->uri));
     if (!$member) {
         return false;
     }
     if ($this->member) {
         $acl = $this->getCollectionAcl($this->getParentObject(), $this->member);
         if (!$acl || !$acl->isAllowed($this->member->id, null, 'add')) {
             return false;
         }
     }
     $gd = $xml->children(opGDataDocument::NAMESPACE);
     if (!$gd) {
         return false;
     }
     $when = $gd->when[0]->attributes();
     $where = $gd->where[0]->attributes();
     $event = new CommunityEvent();
     $event->setMember($member);
     $event->setCommunity($this->getParentObject());
     $event->setName((string) $xml->title);
     $event->setBody((string) $xml->content);
     $event->setOpenDate((string) $when['startTime']);
     $event->setOpenDateComment('');
     $event->setArea((string) $when['valueString']);
     $event->save();
     return $event;
 }