public function setup()
 {
     $config = opPointPluginConfiguration::getPointConfig();
     foreach ($config as $name => $value) {
         $this->setWidget($name, new sfWidgetFormInput());
         $this->setValidator($name, new sfValidatorInteger());
         $this->setDefault($name, Doctrine::getTable('SnsConfig')->get('op_point_' . $name, 0));
         $caption = isset($value['caption']) ? $value['caption'] : $name;
         $this->widgetSchema->setLabel($name, $caption);
     }
     $this->widgetSchema->setNameFormat('op_point_configure[%s]');
 }
 /**
  * initialize plugin
  *
  */
 public function initialize()
 {
     if ($this->configuration instanceof sfApplicationConfiguration) {
         $file = 'config/op_point.yml';
         $this->configuration->getConfigCache()->registerConfigHandler($file, 'sfSimpleYamlConfigHandler');
         self::$pointConfig = (include $this->configuration->getConfigCache()->checkConfig($file));
         foreach (self::$pointConfig as $key => $value) {
             if (isset($value['event'])) {
                 $listener = isset($value['listener']) ? $value['listener'] : array($this, 'listenTo' . sfInflector::camelize($key));
                 if (is_array($value['event'])) {
                     foreach ($value['event'] as $eventName) {
                         $this->dispatcher->connect($eventName, $listener);
                     }
                 } else {
                     $this->dispatcher->connect($value['event'], $listener);
                 }
             } else {
                 throw new LogicException('op_point.yml is wrong');
             }
         }
     }
 }