This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » symfony 1.3 and 1.4 » Properties on a module: a visibility problem
Properties on a module: a visibility problem [message #102733] Mon, 19 July 2010 11:47
wildancer  is currently offline wildancer
Messages: 1
Registered: July 2010
Junior Member
Good morning, I'm just a n00b, and my English is bad: I hope to expose my problem: I have a module where the index make a query and passes directly one of the results at the edit: once I save the form, I avoid making the query again, so I tried to put the doctrine collection as a property class, but this does not work: why processForm() does not see '$ this-> scansioni'?
class esitoActions extends sfActions{
  protected $scansioni;
  protected $segno;
  public function executeIndex(sfWebRequest $request){
    $this->segno = $request->getParameter('segno');
    $this->forward404Unless($this->scansioni = Doctrine_Query::create()
					->from('scansioni')
					->where('pacco = \''.$request->getParameter('pacco').'\'')->execute(),
				sprintf('Objects searched does not exists (%s).', $request->getParameter('pacco'))
			);
      $this->redirect('esito/edit?immagine='.$this->scansioni[$this->segno]->getImmagine());
  }

  public function executeEdit(sfWebRequest $request){
    $this->forward404Unless($scansione = Doctrine::getTable('scansioni')->find(array($request->getParameter('immagine'))), sprintf('Object scansioni does not exist (%s).', $request->getParameter('immagine'))); // this line it's useless if I cud use $this->scansioni[$this->segno] in the new form... Only 1 query at the beginning!
    $this->form = new scansioniForm($scansione);
  }

  public function executeUpdate(sfWebRequest $request){
    $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
    $this->forward404Unless($scansione = Doctrine::getTable('scansioni')->find(array($request->getParameter('immagine'))), sprintf('Object scansioni does not exist (%s).', $request->getParameter('immagine')));
    $this->form = new scansioniForm($scansione);
    $this->processForm($request, $this->form);
    $this->setTemplate('edit');
  }

  protected function processForm(sfWebRequest $request, sfForm $form){
    $form->bind($request->getParameter($form->getName()));
    if ($form->isValid()){
      $scansione = $form->save();
      $this->redirect('esito/edit?immagine='.$this->scansioni[$this->segno]->getImmagine()); //<----- DON'T WORK ?!?!
    }
  }
}

[Updated on: Mon, 19 July 2010 12:13]

Previous Topic:How to creating custom xml feed (atom) using sfAtom1Feed plugin
Next Topic:[SOLVED]Nested set and looped-insert
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software