Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.62 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. class TnlExpenseCommentForm extends BaseTnlExpenseCommentForm
  4. {
  5.   public function configure()
  6.   {
  7.     $this->useFields(array('body'));
  8.  
  9.     $this->widgetSchema->setHelp('body' ,'Please enter a comment regarding to the expense.');
  10.  
  11.     $this->widgetSchema->setLabel('body', 'Comment');
  12.  
  13.     $this->validatorSchema['body']->setOption('required', false);
  14.   }
  15.  
  16.   public function updateObject($values = null)
  17.   {
  18.     $comment = parent::updateObject($values);
  19.    
  20.     if ($comment->isNew())
  21.     {
  22.       $comment->setCreatedBy($this->getOption('user')->getGuardUser()->getId());
  23.     }
  24.  
  25.     return $comment;
  26.   }
  27. }