Issue Details (XML | Word | Printable)

Key: GRAILS-3510
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Graeme Rocher
Reporter: Pam
Votes: 2
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Grails

all functions called from inside of a webFlow are interpreted as events, and return events rather than the objects you might be trying to return

Created: 27/Oct/08 02:24 PM   Updated: 10/Sep/09 11:15 AM   Resolved: 14/Apr/09 07:48 AM
Return to search
Component/s: WebFlow
Affects Version/s: 1.0.3, 1.1
Fix Version/s: 1.1.1

Time Tracking:
Not Specified


 Description  « Hide

Calls to methods inside the controller class, from a webFlow, are considered calls to webFlow events, and return an event rather than something you might be trying to return. I found this out because I kept getting "result" stuck into the model rather than an actual object I was trying to create.

A workaround from Graeme:
> The problem seems to be that the calls to the methods
> createOrLoadSeries(flow,params) and createOrLoadSnapshot(flow,params)
> are actually returning webflow events. This could well be regarded as
> a bug, but the reason it behaves this way is that the closure is set
> to resolve methods to the webflow first as you can see from this line:
>
> http://svn.grails.codehaus.org/browse/grails/trunk/grails/src/groovy/org/codeh
> aus/groovy/grails/webflow/engine/builder/ClosureInvokingAction.groovy?r=7257#l
> 104
>
> The result is that it will result to the flow, which will create an
> event called "createOrLoadSeries" and return it. You can get around
> this by prefixing these calls with "this." which will ensure they
> result to the outer class rather than the flow:
>
> flow.series = this.createOrLoadSeries(flow,params);
> flow.snapshot = this.createOrLoadSnapshot(flow,params);
>
> This could well be regarded as a bug and feel free to raise an issue.
> The reason I believe the behavior is the way it is is because if it
> resolved to the class first, then it would pick up controller scopes
> such as "flash" rather than the webflow scopes of the same name.
>
> We'd have to consider how to implement the code in a different way to
> avoid this conflict.



Marc Palmer added a comment - 30/Mar/09 10:44 AM

This seemed OK for us in 1.0.4 but is broken and returning "result" again in Grails 1.1


Graeme Rocher added a comment - 14/Apr/09 07:48 AM

fixed in Git master


Jan Rudert added a comment - 10/Sep/09 11:15 AM

Please reopen, this issue is not fixed for webflow tests.