I have created a route like this:
linharecibo_new:
  url:     /linharecibo/new/
  class:   sfDoctrineRoute
  options: { model: Recibo, type: object }
  param:   { module: linharecibo, action: new }
  requirements:
    sf_method: [get]

And i have changed de "executeNew" action.
  public function executeNew(sfWebRequest $request)
  {

  $linha = new LinhaRecibo();
  $id_recibo = $this->getRoute()->getObject()->getId();

  $linha->setIdrecibo($id_recibo);

   // $this->forward404Unless($id_recibo);
    $this->form = new LinhareciboForm($linha);
    }

I have changed to this, like Gareth McCumskey sad  but i get the same
error. What I'm doing wrong?

 public function executeNew(sfWebRequest $request)
  {

  $linha = new LinhaRecibo();
  $id_recibo = $this->getRoute()->getObject()->getId();

  $linha->setIdrecibo($id_recibo);

   // $this->forward404Unless($this->id_recibo);
    $this->form = new LinhareciboForm();
    //$this->form = new LinhareciboForm($linha);
    $this->form->setDefault('idrecibo', $id_recibo);

  }

this is the default code to validate the form:


abstract class BaseLinhareciboForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'        => new sfWidgetFormInputHidden(),
      'idrecibo'  => new sfWidgetFormInputHidden(),
      'idproduto' => new sfWidgetFormDoctrineChoice(array('model' =>
$this->getRelatedModelName('Produto'), 'add_empty' => false)),
      'quatidade' => new sfWidgetFormInputText(),
      'total'     => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'        => new sfValidatorDoctrineChoice(array('model' =>
$this->getModelName(), 'column' => 'id', 'required' => false)),
      'idrecibo'  => new sfValidatorDoctrineChoice(array('model' =>
$this->getModelName(), 'column' => 'idrecibo', 'required' => false)),
      'idproduto' => new sfValidatorDoctrineChoice(array('model' =>
$this->getRelatedModelName('Produto'))),
      'quatidade' => new sfValidatorInteger(),
      'total'     => new sfValidatorNumber(),
    ));

    $this->widgetSchema->setNameFormat('linharecibo[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this-
>validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  thank you for your help.

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

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to