
| Key: |
GRAILS-3510
|
| Type: |
Bug
|
| Status: |
Resolved
|
| Resolution: |
Fixed
|
| Priority: |
Blocker
|
| Assignee: |
Graeme Rocher
|
| Reporter: |
Pam
|
| Votes: |
2
|
| Watchers: |
2
|
|
If you were logged in you would be able to see more operations.
|
|
|
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.
|
|
Description
|
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. |
Show » |
Sort Order:
|
This seemed OK for us in 1.0.4 but is broken and returning "result" again in Grails 1.1