/**
  * Shortcut for logging a message
  * 
  * @param string $message
  * @param string $visibility
  * @param array $variables
  * @param Doctrine_Record $issuer
  * @return boolean whether the entry has been saved successfully
  */
 public function logMessage($message, $visibility, array $variables = null, Doctrine_Record $issuer = null)
 {
     if (!is_null($variables) && !is_array($variables)) {
         throw new InvalidArgumentException('$variables must be an array, or null.');
     }
     if (!is_null($issuer) && !$issuer instanceof Doctrine_Record) {
         throw new InvalidArgumentException('$issuer must be an instance of Doctrine_Record, or null.');
     }
     if ($issuer !== null && count((array) $issuer->getTable()->getIdentifier()) !== 1) {
         throw new RuntimeException('Issuer Entities with composite primary keys are not supported.');
     }
     if (count((array) $this->getInvoker()->getTable()->getIdentifier()) !== 1) {
         throw new RuntimeException('Records with composite primary keys are not supported.');
     }
     $logEntry = new BlameableLogEntry();
     $logEntry->target_entity_id = $this->getInvoker()->{$this->getInvoker()->getTable()->getIdentifier()};
     $logEntry->target_entity_type = get_class($this->getInvoker());
     $logEntry->message = $message;
     $logEntry->visibility = $visibility;
     $logEntry->variables = $variables;
     if (!is_null($issuer)) {
         $logEntry->issuer_entity_id = $issuer->{$issuer->getTable()->getIdentifier()};
         $logEntry->issuer_entity_type = get_class($issuer);
     }
     $logEntry->save();
     $logEntry->free(true);
 }
 protected function logMessage($event, $visibility, $message, $variables = null)
 {
     $logEntry = new BlameableLogEntry();
     $record = $event->getInvoker();
     $pKey = $record->getTable()->getIdentifier();
     if (is_array($pKey)) {
         throw new RuntimeException('Records with multi-column primary keys are not supported.');
     }
     $logEntry->target_entity_id = $record->{$pKey};
     $logEntry->target_entity_type = get_class($record);
     // TODO: Allow the user to specify a way how the acting user id is being determined
     if (sfContext::hasInstance() && sfContext::getInstance()->getUser() instanceof jmsUser && sfContext::getInstance()->getUser()->isAuthenticated()) {
         $logEntry->issuer_entity_id = sfContext::getInstance()->getUser()->id;
         $logEntry->issuer_entity_type = 'User';
     }
     $logEntry->message = $message;
     $logEntry->visibility = $visibility;
     $logEntry->variables = $variables;
     $logEntry->save();
     $logEntry->free(true);
 }