protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
    if ($form->isValid())
    {
      $isNew = $form->getObject()->isNew();
      $notice = $isNew ? 'Your reply was saved successfully.' : 'The item was updated successfully.';

      $sf_nested_comment = $form->save();

      $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $sf_nested_comment)));
      
      $email_pref = sfNestedCommentConfig::isMailEnabled();
      $enable_mail_alert = $email_pref === true || $email_pref == 'moderated';

      if ($isNew && $enable_mail_alert && $sf_nested_comment->isReply())
      {
        $userComment = $sf_nested_comment->getsfNestedCommentRelatedBySfCommentId();
        $params = $this->prepareMailParameter($sf_nested_comment, $userComment);
        sfNestedCommentTools::sendEmail($this->getMailer(), $params);
      }
      
      $this->getUser()->setFlash('notice', $notice);
      $this->redirect('@sf_nested_comment');
    }
    else
    {
      $this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
    }
  }
 public function getCommentableObject()
 {
   $scope = $this->getSfCommentableModelId();
   if (!isset($this->commentableObjects[$scope]))
   {
     $commentableObject = sfNestedCommentTools::getCommentableObject($this->getsfNestedCommentableModel());
     $this->commentableObjects[$scope] = $commentableObject;
   }
   return $this->commentableObjects[$scope];
 }
<?php $use_ajax = sfNestedCommentConfig::isAjaxEnabled() ?>
<?php $enable_nested = sfNestedCommentConfig::isNestedEnabled() ?>

<?php if (sfNestedCommentConfig::isNestedEnabled()): ?>
  <?php use_helper('sfNestedCommentPagination') ?>
  <?php $url = $use_ajax ? '@sf_nested_comment_commenting' : $sf_request->getPathInfoPrefix().$sf_request->getPathInfo() ?>
  <?php echo comment_pagination($comments, $url, $sf_request->getParameterHolder(), 'Earlier Comments', 'Older Comments') ?>
  <?php $comments = $comments->getResults() ?>
<?php endif; ?>
<?php $renderer = sfNestedCommentTools::createCommentsRenderer($comments, $enable_nested) ?>
<?php echo $renderer->render() ?>
      <?php $suffix = $i == 1 ? 'top' : 'end' ?>
      <tr>
        <?php if ($use_gravatar): ?>
        <td class="<?php echo $cls.$suffix ?>" style="height: 32px; width: 32px" title="<?php echo $comment->getAuthorName() ?>">
          <?php if ($comment->getAuthorUrl()): ?>
          <a rel="nofollow" href="<?php echo $comment->getAuthorUrl() ?>">
            <?php echo gravatar_image_tag($comment->getAuthorEmail(), null, 32) ?>
          </a>
          <?php else: ?>
            <?php echo gravatar_image_tag($comment->getAuthorEmail(), null, 32) ?>
          <?php endif; ?>
        </td>
        <?php endif; ?>
        <td class="recentcommentstext<?php echo $suffix?>">
          <?php if ($comment->getAuthorUrl()): ?>
            <a rel="nofollow" href="<?php echo $comment->getAuthorUrl() ?>"><?php echo $comment->getAuthorName() ?></a>
          <?php else: ?>
            <?php echo $comment->getAuthorName() ?>
          <?php endif; ?>
          <?php echo __('on') ?>&nbsp;
          <?php if (false !== $url = url_for_commentable_object($commentableObject)): ?>
            <a href="<?php echo $url.'#comment-'.$comment->getId() ?>"><?php echo sfNestedCommentTools::ellipsis($commentableObject->__toString()) ?></a>
          <?php else: ?>
            <?php echo sfNestedCommentTools::ellipsis($commentableObject->__toString()) ?>
          <?php endif; ?>
        </td>
      </tr>
      <?php $i++ ?>
    <?php endforeach; ?>
  </tbody>
</table>
 public function executePreview(sfWebRequest $request)
 {
   $this->forward404Unless($request->isXmlHttpRequest() && $request->isMethod('post'));
   $this->setLayout(false);
   
   $commentText = sfNestedCommentTools::clean($request->getPostParameter('commentText'));
   return $this->renderText($commentText);
 }
 public function executeShowComments(sfWebRequest $request)
 {
   $this->comments = sfNestedCommentTools::getComments($this->object, $request);
   $this->commentForm = sfNestedCommentTools::createCommentForm($this->object, $this->getUser());
 }
 public function updateContentColumn($value)
 {
   return sfNestedCommentTools::clean($value);
 }