logo       

Re: two templates showing after ->forward - result of try/catch?: msg#00022

Subject: Re: two templates showing after ->forward - result of try/catch?
Andrew,

The ->forward() method throws an exception:

  throw new sfActionStopException();

This exception stops the code to stop the execution of your action and of the current filter chain. That's why you don't have to put a 'return' statement before a ->forward() (or a ->redirect()).

But in your case, you catch the Exception, so, the action is not stopped. Try to change your code with:

  $this->forward($this->getModuleName(), 'getToIt');

  return sfView::NONE;

to see if it solves your problem.

You can also trap the sfActionStopException in your code.

Fabien

Andrew Backer wrote:
I am having an issue that was discussed before, where two templates show sometimes. I haven't done much investigation, but this is happening to me when I have a $this->forward() inside of a try/catch block. The code is something like this :

// page posted to from the getToIt action
try {
  ...
  ...
  if ( $obj->status() == no_good) {
     ...
     // this forward gets called, actually, and goes f
     $this->forward($this->getModuleName(), 'getToIt');
  }
} catch {
  // if I put a echo "blah";die(); here it will show at bottom of page
  $this->log->err(" it didn't work! fix your code, bad coder person");
}

I can stop it by actually putting a die() inside the catch. I have no clue what is going on, but I assume it is something with the way php works and the fact that isn't not quite 'real' in it's objects (like letting functions be called statically when they aren't) that makes this thing do two actions.

Anyone have any ideas? I am going to re-arrange the code so this doesn't happen now, but it's still quite odd.

- Andrew

--
To unsubscribe, e-mail: 
user-unsubscribe-eP6cZdsBvs6tlBvVaVFjCkEOCMrvLtNR@xxxxxxxxxxxxxxxx
For additional commands, e-mail: 
user-help-eP6cZdsBvs6tlBvVaVFjCkEOCMrvLtNR@xxxxxxxxxxxxxxxx





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe