Difference in mapping mediators from RL 1.0.3 to 1.1.2
Hey, I have the following in my context
override public function startup():void
{
// model
this.injector.mapSingleton( BookProxy );
// view
this.mediatorMap.mapView( Book, BookMediator );
// controller
this.commandMap.mapEvent( ContextEvent.STARTUP_COMPLETE, StartupCommand, ContextEvent );
// add book to context
contextView.addChild( new Book() );
// go!
super.startup();
}
When using 1.1.2 I get an error ("Injector is missing a rule to handle injection into target") when injecting the mediator into a command, but when using 1.0.3 it works.
thanks!
Alastair
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Shaun Smith on 21 Aug, 2010 04:25 PM
Is the failing injection target Book?
RL 1.1.2 no longer injects into the view component of a view-mediator pair (this was a bug and has been fixed).
When using the mediator pattern it is not recommended that you inject directly into your view components, but rather: inject into your mediator and pass the values through.
If you really do want to inject into your view components then you must now explicitly do so from your mediator:
Hope that helps!
2 Posted by Abel de Beer on 21 Aug, 2010 07:24 PM
@Alastair You're saying you want to inject your Mediator into a Command. The main reason this is difficult is because the only way your Mediators should communicate with the rest of the framework is through events (or signals). So instead of trying to inject the Mediator into a Command, have the Command (or other framework actor) dispatch an event that the Mediator is listenening for.
Read more on this issue here: http://knowledge.robotlegs.org/faqs/framework-core/why-cant-i-injec...
Support Staff 3 Posted by Shaun Smith on 21 Aug, 2010 07:33 PM
Ah, sorry, I missed this: "when injecting the mediator into a command".. Thanks for picking up on that @abeldebeer
The workaround, in that case, would be something like this:
Stray closed this discussion on 16 Feb, 2011 09:05 PM.