Guys,

I'm trying to change a field to use multiple choose select on my admin
generator module.

For to do it I follow these steps.

I've changed the formfilter class on generate.yml like this

filter:
        class: BackendHotelDescriptionFormFilter


than, I create this class extending the Base class.

<code>
class BaseHotelDescriptionFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'description_type_id' => new sfWidgetFormDoctrineChoice(array
('model' => 'DescriptionType', 'add_empty' => true)),
      'hotel_id'            => new sfWidgetFormDoctrineChoice(array
('model' => 'Hotel', 'add_empty' => true)),
    ));
</code>

on my extend class I changed the widget to add the attribute multiple
choose like this

<code>
class BackendHotelDescriptionFormFilter extends
BaseHotelDescriptionFormFilter
{
  public function configure()
  {
    $widgets = $this->getWidgetSchema();
    $validators = $this->getValidatorSchema();

    $widgets['description_type_id']->setAttribute('multiple', true );
</code>

It's work until here..The problem is when I select more than one field
and post form, I use the latest selected option..

Is it the best way? how can I do it?

Here's my schema.

HotelDescription:
  tableName: hotel_description
  actAs:
    I18n:
      fields: [description]
      actAs:
        Timestampable: ~
  columns:
    description_type_id:  { type: integer(10), notnull: true }
    hotel_id:             { type: integer(10), notnull: true }
    description:          { type: string, notnull: true }
  relations:
    DescriptionType:
      local: description_type_id
      foreign: id
      type: one
    Hotel:
      local: hotel_id
      foreign: id
      type: one

DescriptionType:
  tableName: description_type
  actAs:
    I18n:
      fields: [name]
      actAs:
        Timestampable: ~
  columns:
    id:         { type: integer(10), primary: true }
    name:       { type: string(100), notnull: true }



Regards,

Nei


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