/**
  * Attempts the mutation.
  * 
  * If the mutation completes abnormally, previous mutators are aborted.
  * 
  * Otherwise returns the results of the mutation.
  * 
  */
 final function mutate($class, $name, $arguments)
 {
     $this->mutation_pointer[] = $name;
     $result = DBObject::mutator($class, $name, $arguments)->activate();
     if ($result) {
         $mutation = new stdclass();
         $mutation->result = $result;
         $mutation->class = $class;
         $mutation->name = $name;
         $mutation->arguments = $arguments;
         $this->mutated($mutation);
         return $result;
     } else {
         $this->abort();
     }
 }
 public final function applyMutator($name, $parameters = array(), $toString = "__toString")
 {
     $results = array();
     while ($managed_object = $this->nextObject()) {
         $value = DBObject::mutator($this->managed_object(), $name, array_merge(array($managed_object), (array) $parameters))->activate();
         $key = call_user_func(array($managed_object, $toString));
         $results[$key] = $value;
         unset($managed_object);
     }
     return $results;
 }
 function send($html_mode = false)
 {
     if (Config::isLive() || Config::isStaging()) {
         $mail = $this->getEmailer();
         if ($this->send_as_html) {
             //many mail servers break 8bit encoding by adding newlines, QP prevents that for ASCII-only emails (like this)
             $mail->Encoding = "quoted-printable";
             $mail->isHTML(true);
         }
         $mail->Subject = $this->getSubjectWithReplacements();
         $mail->Body = $this->getBodyWithReplacements();
         if (!$mail->Send()) {
             error_log("ERROR: mail not sent: {$mail->ErrorInfo}");
             return false;
         } else {
             if ($this->recordMember) {
                 Loader::load('model', 'com/htmlgraphic/history/Transaction');
                 DBObject::mutator('Transaction', 'RecordContactEmailSentAction', array($this, $this->recordMember))->activate();
             }
         }
         return true;
     } else {
         //this is so you can see if you would have sent an email on a dev box
         if ($this->recordMember) {
             Loader::load('model', 'com/htmlgraphic/history/Transaction');
             DBObject::mutator('Transaction', 'RecordContactEmailSentAction', array($this, $this->recordMember))->activate();
         }
         //error_log(print_r($this->recordMember,true));
         Debugger::log("<span style='color: #fff;'>Subject:</span> " . $this->getSubjectWithReplacements() . "<br><br><span style='color: #fff;'>-----Body-----</span><br>" . $this->getBodyWithReplacements() . "<br><span style='color: #fff;'>-----Body-----</span>");
         return true;
     }
 }