Eno escribió:
> On Tue, 1 Sep 2009, Germana Oliveira wrote:
>
>   
>> BUT I HAVE TWO PROBLEMS:
>>
>> 1. with a new form (isNew):
>> Notice: Undefined offset: 0 in
>> /home/germana/www/indepabis/lib/form/PersonaForm.class.php on line 53
>>     
>
> Were these form classes generated from models?
>   
Yes, these clases are generated from models....
> Also what does the code of PersonaForm.class.php look like? What is around 
> line 53?
>
>   
PersonaForm:

class PersonaForm extends BasePersonaForm
{

  public function configure($object = null, $options = array())
  {
    parent::configure();
    unset($this['id']);

    $this->widgetSchema['direccion'] = new sfWidgetFormTextArea(array(), 
array('cols' => '50', 'rows' => '2'));
    $this->widgetSchema['estado_id'] = new sfWidgetFormPropelChoice(
      array(
        'model'      => 'Estado',
        'add_empty'  => false,
        'order_by'   => array('Nombre', 'asc'),
      )
    );
    $this->widgetSchema['municipio_id'] = new sfWidgetFormPropelChoice(
      array(
        'model'       => 'Municipio',
        'add_empty'   => false,
        'order_by'    => array('Nombre', 'asc'),
        'criteria'    => 
MunicipioPeer::criteriaMunicipio(EstadoPeer::obtenerPorNombre('Carabobo')->getId()),
      )
    );
    $this->widgetSchema['parroquia_id'] = new 
sfWidgetFormPropelChoice(array(
       'model'       => 'Parroquia',
       'add_empty'   => false,
       'order_by'    => array('Nombre', 'asc'),
       'criteria'    => 
ParroquiaPeer::criteriaParroquia(EstadoPeer::obtenerPorNombre('Carabobo')->getId(),
 
MunicipioPeer::obtenerPorNombre('Valencia')->getId()),
    ));

    $this->setDefault('estado_id', 
EstadoPeer::obtenerPorNombre('Carabobo')->getId());
    $this->setDefault('municipio_id', 
MunicipioPeer::obtenerPorNombre('Valencia')->getId());

    $tipo_persona = strtolower($options[0]);  ----> LINE 52
    $tipo_persona_id = 
TipoPersonaPeer::obtenerPorNombre($tipo_persona)->getId();
    $this->setDefault('tipo_persona_id', $tipo_persona_id);

    $this->setValidators(array(
      'nombre'            => new sfValidatorString(
                              array('required' => true, 'min_length'=> 3),
                              array('required' => 'Campo Requerido', 
'min_length' => 'El nombre es muy corto')
                              ),
      'identificacion'    => new sfValidatorNumber(
                              array('required' => true),
                              array('required' => 'Campo Requerido', 
'invalid' => 'Introduzca solo numeros')
                              ),
     'tipo_persona_id'     => new sfValidatorPropelChoice(array('model' 
=> 'TipoPersona', 'column' => 'id')),
     'estado_id'           => new sfValidatorPropelChoice(array('model' 
=> 'Estado', 'column' => 'id')),
     'municipio_id'        => new sfValidatorPropelChoice(array('model' 
=> 'Municipio', 'column' => 'id')),
     'parroquia_id'        => new sfValidatorPropelChoice(array('model' 
=> 'Parroquia', 'column' => 'id')),
     'tipo_identificacion' => new sfValidatorChoice(array('choices' => 
array('V-' => 'V', 'E-' => 'E', 'J-' => 'J'))),
      'telefono'           => new sfValidatorNumber(
                              array('required' => false),
                              array('invalid' => 'Introduzca solo numeros')
                              ),
      'direccion'          => new sfValidatorString(
                              array('required' => true, 'min_length'=> 4),
                              array('required' => 'Campo Requerido', 
'min_length' => 'La direccion es muy corta')
                              )
    ));

    $this->widgetSchema->setLabels(array(
      'tipo_persona_id'  => 'Tipo de Persona',
    ));
  }

}


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