Spicefactory Forum Index Spicefactory
Forum Archive
 SearchSearch    Log inLog in 


Post new topic   Reply to topic    Spicefactory Forum Index -> Spicefactory
View previous topic :: View next topic  
Author Message

Joined: 23 Apr 2012
Posts: 4

PostPosted: Tue May 08, 2012 3:36 pm    Post subject: Commands Reply with quote

Hello all!

I'm currently trying to use asynchronous commands to wrap my (remote) service calls so that I can work with e.g. Command Groups.

1) Basic things are working fine. Though I'm currently wondering how to pass parameters to my service call which is done within the execute() method?

I setup up the following class:

public class MyCmd {
public function execute (): void {
service.myMethodCall([params here?]).addResponder(new AsyncResponder(resultHandler,errorHandler));

I read in the docs about how to pass data within the command group (e.g. result from cmd1 as input to cmd2). But in this case, I would need to forward some parameters to the execute() method / the actual service method invokation respectively, which result e.g. from user input. How is this to be done correctly?

Of course I could have individual constructors with the parameters for each of my custom commands where I can then set any class members to use for my service call, but this would for example prevent me from doing things like mentioned in 2) see below...

2) I implemented a base class for my custom commands which holds a reference to the service that is called within the execute method of a derived class and the result and error handler methods. I further tried to let parsley manage my custom commands in order to have dependency injection for the service within the base class. This seems to work fine... But I'm wondering if it's considered good / bad practice to have more or less all the commands managed by the container (e.g. due to the need of dependency injection)?

Thanks in advance for sharing your thoughts!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Spicefactory Forum Index -> Spicefactory All times are GMT + 1 Hour
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group