tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/15290-mapping-event-with-second-type-to-command-is-not-workingRobotlegs: Discussion 2016-08-10T10:41:42Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/404497352016-08-09T09:26:24Z2016-08-09T09:26:24ZMapping event with second type to command is not working<div><p>Hi Oleg,<br>
Sorry for the late response. I haven't received any notifications
about your message, and since you've marked the discussion as
private, I didn't see it on the forum's web page either, until now.
Is there any reason you want this discussion to be private, or it
just happened by accident?<br>
To your question:<br>
There is no limitation on the number of events or event types
mapped to a command.<br>
In robotlegs 2 the mapping should look like this:</p>
<pre>
<code>public class SomeConfig implements IConfig
{
[Inject]
public var commandMap:IEventCommandMap;
public function configure():void
{
commandMap.map(SomeEvent.SOME_TYPE, SomeEvent).toCommand(SomeCommand);
commandMap.map(SomeEvent.ANOTHER_TYPE, SomeEvent).toCommand(SomeCommand);
commandMap.map(AnotherEvent. OTHER_TYPE, SomeEvent).toCommand(AnotherCommand);
}
}</code>
</pre>
<p>What is moduleCommandMap in your example? Is it just the name of
the variable of type IEventCommandMap?</p>
<blockquote>
<p>Now I am adding a second type - type2, and the rest is similar
(except I pass extra params to Stored Proc 2).</p>
</blockquote>
<p>If your event is carrying a payload ( the params ?), you need to
inject the event into your command, so that you can access the
params there:</p>
<pre>
<code>[Inject]
public var event: ChangePasswordEvent;
public function execute():void
{
doSomethingWith(event.payload);
}</code>
</pre>
<p>If that doesn't solve your problem, please show the code (or an
example) where your command is trying to access the event's
payload.<br>
Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/404497352016-08-09T11:43:01Z2016-08-10T10:41:05ZMapping event with second type to command is not working<div><p>Hi,<br>
I was able to resolve it:in second case user is entering there
through deep linking,(parent of popup is different)so I needed to
use different context Thank you for your help, Oleg.</p></div>olegkontag:robotlegs.tenderapp.com,2009-10-18:Comment/404497352016-08-10T10:41:34Z2016-08-10T10:41:34ZMapping event with second type to command is not working<div><p>No problem!</p></div>Ondina D.F.