-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build all from dependency injection #88
Conversation
$request = $request ?: ServerRequestFactory::fromGlobals(); | ||
$response = $response ?: new Response(); | ||
$request = $request ?: $this->getContainer()->get("request"); | ||
$response = $response ?: $this->getContainer()->get("response"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
single quote
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use $this->container
instead of $this->getContainer()
for internally call, as I cleaned up on previous PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getContainer is a private API :)
2015-10-08 10:57 GMT+02:00 Abdul Malik Ikhsan notifications@github.com:
In src/App.php
#88 (comment):* * @return mixed */ public function run($request = null, $response = null) {
$request = $request ?: ServerRequestFactory::fromGlobals();
$response = $response ?: new Response();
$request = $request ?: $this->getContainer()->get("request");
$response = $response ?: $this->getContainer()->get("response");
use $this->container instead of $this->getContainer() for internally
call, as I cleaned up on previous PR—
Reply to this email directly or view it on GitHub
https://github.com/pennyphp/penny/pull/88/files#r41490323.
Gianluca Arbezzano
www.gianarb.it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not, it writtten public function getContainer()
This implementation creates an inconsistence, if you use
To change request and response in your application now you can override them by DiC. @fntlnz @EmanueleMinotto @samsonasik feedback around this approach? |
$response = $response ?: new Response(); | ||
|
||
$event = new HttpFlowEvent('bootstrap', $request, $response); | ||
$event = $this->getContainer()->get("http_flow_event"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use single quotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see https://github.com/pennyphp/penny/blob/master/src/App.php#L48-L51 , getContainer()
only return container
, and calling internally should not need to call getter, just call $this->container
direclty
4e7df8b
to
078a1de
Compare
DescriptionWith this PR I try to build all by DiC, in my opinion this is a good improvement because now we can replace To maintain this feature (powerful into the unit/functional test) use Penny\App;
$app = new App();
$request = new \Request();
$response = new \Response();
$app->run($request, $response); I wrote |
At the moment this solution doesn't work. This PR rappresent an idea. I'm trying to build from DI the event_http_flow but if I use only DI to build it the application doesn't work Because `->get('request')` and `->get('response')` could not be set.
078a1de
to
9c047b3
Compare
Build all from dependency injection
Good job |
At the moment this solution doesn't work.
This PR describe an idea.
I'm trying to build from DI the event_http_flow but
if I use only DI to build it the application doesn't work
Because
->get('request')
and->get('response')
could not be set.