/plugins/vjCommentPlugin/lib/filter/doctrine/PluginCommentFormFilter.class.php

https://bitbucket.org/Kudlaty/360kdw · PHP · 28 lines · 17 code · 3 blank · 8 comment · 1 complexity · e840e61b5d6540d72e0692d81b601ac4 MD5 · raw file

  1. <?php
  2. /**
  3. * PluginComment form.
  4. *
  5. * @package vjCommentPlugin
  6. * @subpackage filter
  7. * @author Jean-Philippe MORVAN <jp.morvan@ville-villejuif.fr>
  8. * @version SVN: $Id: sfDoctrineFormFilterPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
  9. */
  10. abstract class PluginCommentFormFilter extends BaseCommentFormFilter
  11. {
  12. public function setup()
  13. {
  14. parent::setup();
  15. $this->widgetSchema['record_model'] = new sfWidgetFormDoctrineChoice(array('model' => 'Comment', 'key_method' => 'getRecordModel', 'method' => 'getRecordModel', 'add_empty' => true));
  16. $this->validatorSchema['record_model'] = new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Comment', 'column' => 'record_model'));
  17. }
  18. public function addRecordModelColumnQuery($query, $field, $value)
  19. {
  20. if (!empty($value))
  21. {
  22. $query->addWhere('record_model=?', $value);
  23. }
  24. }
  25. }