I use symfony 1.4.5.

//lib/filter/doctrine/BackendgammeFormFilter.class.php

  1 <?php
  2
  3 /**
  4  * Gamme filter form backend class.
  5  *
  6  * @package    refactor_metaux
  7  * @subpackage filter
  8  * @author     Florian PÉRIN
  9  * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php
29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 10  */
 11 class BackendGammeFormFilter extends GammeFormFilter
 12 {
 13   public function configure()
 14   {
 15       $this->addWidgets();
 16       $this->addValidators();
 17       $this->widgetSchema->setNameFormat('gamme_filters[%s]');
 18       $this->errorSchema = new sfValidatorErrorSchema($this-
>validatorSchema);
 19   }
 20
 21   public function addWidgets()
 22   {
 23     $this->setWidgets(array(
 24       'nom'          => new sfWidgetFormDoctrineChoice(array(
 25                                 'model' => 'Gamme',-
 26                                 'add_empty' => true,-
 27                                 'order_by' => array('nom',
'asc'),-
 28                         )),
 29       'image'        => new sfWidgetFormFilterInput(),
 30       'description'  => new sfWidgetFormFilterInput(),
 31       'deuxcolonnes' => new sfWidgetFormChoice(array( 'choices' =>
array( '' => 'oui ou non', '0' => 'non', '1' => 'oui'), ) ),
 32       'enligne'      => new sfWidgetFormChoice(array( 'choices' =>
array( '' => 'oui ou non', '0' => 'non', '1' => 'oui'), ) ),
 33       'lienspe'      => new sfWidgetFormFilterInput(),
 34     ));
 35   }
 36
 37   public function addValidators()
 38   {
 39     $this->setValidators(array(
 40       'nom'          => new sfValidatorChoice( array( 'choices' =>
array($this->getObject()->get('idgamme')), 'required' => false)),
 41       'image'        => new sfValidatorPass(array('required' =>
false)),
 42       'description'  => new sfValidatorPass(array('required' =>
false)),
 43       'deuxcolonnes' => new sfValidatorChoice(array('required' =>
false, 'choices' => array( '0', '1'))),
 44       'enligne'      => new sfValidatorChoice(array('required' =>
false, 'choices' => array( '0', '1'))),
 45       'lienspe'      => new sfValidatorPass(array('required' =>
false)),
 46     ));
 47   }

And it looks before like this:

  1 <?php
  2
  3 /**
  4  * Gamme filter form backend class.
  5  *
  6  * @package    refactor_metaux
  7  * @subpackage filter
  8  * @author     Florian PÉRIN
  9  * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php
29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 10  */
 11 class BackendGammeFormFilter extends GammeFormFilter
 12 {
 13   public function configure()
 14   {
 15       $this->addWidgets();
 16       $this->addValidators();
 17       $this->widgetSchema->setNameFormat('gamme_filters[%s]');
 18       $this->errorSchema = new sfValidatorErrorSchema($this-
>validatorSchema);
 19   }
 20
 21   public function addWidgets()
 22   {
 23     $this->setWidgets(array(
 24       'nom'          => new sfWidgetFormFilterInput(),
 25       'image'        => new sfWidgetFormFilterInput(),
 26       'description'  => new sfWidgetFormFilterInput(),
 27       'deuxcolonnes' => new sfWidgetFormFilterInput(),
 28       'enligne'      => new sfWidgetFormFilterInput(),
 29       'lienspe'      => new sfWidgetFormFilterInput(),
 30     ));
 31   }
 32
 33   public function addValidators()
 34   {
 35     $this->setValidators(array(
 36       'nom'          => new sfValidatorPass(array('required' =>
false)),
 37       'image'        => new sfValidatorPass(array('required' =>
false)),
 38       'description'  => new sfValidatorPass(array('required' =>
false)),
 39       'deuxcolonnes' => new sfValidatorPass(array('required' =>
false)),
 40       'enligne'      => new sfValidatorPass(array('required' =>
false)),
 41       'lienspe'      => new sfValidatorPass(array('required' =>
false)),
 42     ));
 43   }

On 3 août, 12:26, Tom Ptacnik <to...@tomor.cz> wrote:
> What means doesn't work?
> How it looks before ... show BaseFormFilter class, or the schema of
> the object at least.
> Which version of Symfony?
>
> On 3 srp, 11:01, florian périn <poulet.va...@gmail.com> wrote:
>
> > Hello,
>
> > I wanted to change the type of my filters auto-generate with admin-
> > generator, but when I did it, the filters didn't work anymore.
>
> > For exemple, I change :
>
> > //lib/filter/doctrine/BackendGammeFormFilter.class.php
> > [...]
> > 'nom' => new sfWidgetFormDoctrineChoice(array(
> >                                'model' => 'Gamme',
> >                                'add_empty' => true,
> >                                'order_by' => array('nom', 'asc'),
> >                           )),
> > 'enligne' => new sfWidgetFormChoice(array( 'choices => array( ' ' =>
> > 'oui ou non', 0 => 'non', 1 => 'oui') ) ),
> > [...]
>
> > 'nom' => new sfValidatorChoice( array( 'choices' => 
> > array($this->getObject()->get('idgamme')), 'required' => false)),
>
> > 'enligne' => new sfValidatorChoice( array('required' => false,
> > 'choices'  => array( 0, 1) ) ),
> > [...]
>
> > If you have any clue why it doesn't work...
>
> > Thanks,

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to