Abstract console controller #5469

Merged
merged 5 commits into from Jan 3, 2014

Conversation

Projects
None yet
5 participants
Contributor

snapshotpl commented Nov 12, 2013

My idea is create simple console controller ready to use with console ;) What are you think?

Owner

weierophinney commented Nov 12, 2013

This would be even more useful with an initializer that injects the Console instance if available. :)

Contributor

stefanotorresi commented Nov 13, 2013

👍 now add a test!

+
+ return parent::dispatch($request, $response);
+ }
+}
@samsonasik

samsonasik Nov 13, 2013

Contributor

add new line after } for eof_ending

+ public function dispatch(RequestInterface $request, ResponseInterface $response = null)
+ {
+ if (! $request instanceof ConsoleRequest) {
+ throw new InvalidArgumentException('Expected an Console request');
@samsonasik

samsonasik Nov 13, 2013

Contributor

"a" Console, not "an" Console

@ThomasCantonnet

ThomasCantonnet Nov 13, 2013

Contributor

Please be more specific in the exception message.

@snapshotpl

snapshotpl Nov 13, 2013

Contributor

@ThomasCantonnet Example? I think that stack trace will say everything in this case.

@ThomasCantonnet

ThomasCantonnet Nov 14, 2013

Contributor

Exactly, I need more detail in the Exception message so I don't have to go directly to the stack trace ;)

@stefanotorresi

stefanotorresi Nov 14, 2013

Contributor

@snapshotpl

throw new InvalidArgumentException(sprintf(
    '%s can only dispatch requests in a console environment',
    get_called_class()
));

@ghost ghost assigned weierophinney Jan 3, 2014

weierophinney added a commit that referenced this pull request Jan 3, 2014

weierophinney added a commit that referenced this pull request Jan 3, 2014

weierophinney added a commit that referenced this pull request Jan 3, 2014

@weierophinney weierophinney merged commit 619ba2f into zendframework:develop Jan 3, 2014

1 check failed

default The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment