public function setup()
 {
     parent::setup();
     unset($this['title'], $this['description'], $this['relative_path'], $this['lft'], $this['rgt'], $this['level'], $this['created_at'], $this['updated_at']);
     $this->widgetSchema['parent_id'] = new sfWidgetFormInputHidden();
     $this->validatorSchema['parent_id'] = new sfValidatorInteger();
     $this->widgetSchema['name']->setAttribute('size', 10);
     $this->widgetSchema['name']->setLabel('Add subfolder');
     $this->validatorSchema['name'] = new sfValidatorRegex(array('required' => true, 'must_match' => false, 'pattern' => '#[^a-z0-9-_]#i'));
     $this->validatorSchema->setPostValidator(new lyMediaValidatorFolder());
 }
 public function setup()
 {
     parent::setup();
     unset($this['relative_path'], $this['lft'], $this['rgt'], $this['level'], $this['created_at'], $this['updated_at']);
     $query = Doctrine_Query::create()->from('lyMediaFolder f');
     if (!$this->isNew()) {
         $query->where('f.lft < ? OR f.rgt > ?', array($this->getObject()->getLft(), $this->getObject()->getRgt()));
     }
     $this->widgetSchema['parent_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'lyMediaManagerFolder', 'order_by' => array('lft', ''), 'method' => 'getIndentName', 'query' => $query));
     if ($this->isNew()) {
         if ($user = $this->getOption('user')) {
             if ($user->getAttribute('view') == 'icons' && $user->getAttribute('folder_id')) {
                 $this->setDefault('parent_id', $user->getAttribute('folder_id'));
             }
         }
     } else {
         $this->widgetSchema['parent_id']->setOption('add_empty', 'Move to ...');
     }
     $this->validatorSchema['parent_id'] = new sfValidatorDoctrineChoice(array('required' => $this->isNew(), 'model' => 'lyMediaFolder'));
     $this->validatorSchema['name'] = new sfValidatorRegex(array('required' => true, 'must_match' => false, 'pattern' => '#[^a-z0-9-_]#i'));
     $this->validatorSchema->setPostValidator(new lyMediaValidatorFolder());
 }