override the norender setting

Hi,

Bit of an edge case this one, but is there a way to override the
arguments.event.norender() setting?

I've got a handler that has multiple actions which call a private
action. Most of the time I don't want a view, but sometimes I do. So
my handler looks something like this, where I want the foo action to
render a view. I know that I could just set a flag, but I like to know
what is possible :slight_smile:

public function foo( event )
{
runEvent( event="payment.sendOrderConfirmation", private=true );
// this doesn't seem to run..
arguments.event.setView("foo.bar");
}

public function bar( event )
{
runEvent( event="payment.sendOrderConfirmation", private=true );
}

private function sendOrderConfirmation( event )
{
.. do stuff...
arguments.event.norender();
}

I wouldn’t have the private action determine if the public actions have a view or not. It’s none of its business.

The private action should only “send Order Confirmation”. Each public action should determine whether it has a view or not.

  • Gabriel

Yeah, I agree with you; but, as I said most of the time I don't want a
view so was trying to reduce the amount of code (yes, I'm that lazy!)
Always good to know, what you can do :slight_smile:

This is what noRender() does:

if (arguments.remove eq false)
setValue(name=“coldbox_norender”,value=true,private=true);
else
removeValue(name=“coldbox_norender”,private=true);

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

I am curious as to why you are performing
payment.sendOrderConfirmation in an event - why not do this in a
PaymentService or UtilityService?

-Cory

Hi Cory,

I did originally have it in my service layer and then I moved it out,
but to be honest I can't remember why, I'm sure there was a good
reason at the time!

- John