Hi JP.

if read earlier post,  I posted it in this discussion. OK, i show you
in sf1.4:

You can do it following 2 ways:

1.  $this->widgetSchema['your_field'] = new sfWidgetFormDoctrineChoice(
                                        array(
                                        'model' => 'Model name',
                                        'multiple' => true,// default is
false
                                        'expanded' => true, // default is
false
                                        'query' =>
Doctrine_Query::create()->select('m.*')->from('Model name m'), // this is
Query you would like to select
                                        'order_by' => array('name',
'ASC'),//order by ascending order
                                        ),
                                        array()); // this attribute area
*validator:*
   $this->validatorSchema['your_field'] = new
sfValidatorDoctrineChoice(array('model' => 'Model name', 'column' => 'column
name', 'multiple' => true, 'required' => false));


2.  $choices = Doctrine::getTable('Model name')->yourMethodName();

  $this->widgetSchema['your_field'] = new sfWidgetFormChoice(
                                                                      array(

'choices' => $choices
                                                                   ),
array());

  And *validator*:

   $this->validatorSchema['your_field']    = new
sfValidatorChoice(array('choices' => array_keys($choices)), array('invalid'
=> 'Invalid message'));


Both ways will work same, It's depend on your needs.

Good luck



Erkhembayar Gantulga

-- 
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