-
Notifications
You must be signed in to change notification settings - Fork 10
Improvements/#1 #32
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
Improvements/#1 #32
Conversation
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.
Good job 👏
config/services.php
Outdated
use Prooph\EventStore\EventStore; | ||
use Prooph\ServiceBus\CommandBus; | ||
use Zend\Expressive\Application; | ||
use Zend\Expressive\Router\FastRouteRouter; | ||
|
||
|
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.
remove this new line
config/services.php
Outdated
}, | ||
|
||
Application::class => ApplicationFactory::class, | ||
FastRouteRouter::class => RouterFactory::class, |
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.
FastRouter doesn't need a specialised class for factory, I guess you can use the InvokableFactory::class
in this situations.
config/services.php
Outdated
@@ -45,7 +31,7 @@ | |||
return 'root'; | |||
}, | |||
'db_password' => function () { | |||
return 'root'; | |||
return null; |
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 need to be changed, this values should come from environment variables
\DateTimeImmutable $date | ||
): self { | ||
return new self( | ||
$conferenceId, |
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.
Inline arguments
config/commands.php
Outdated
@@ -0,0 +1,14 @@ | |||
<?php | |||
|
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.
Missing docheader
/** | ||
* @author Luciano Queiroz <[email protected]> | ||
*/ | ||
final class RouterFactory |
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.
Kill this class as mentioned above
{ | ||
return new FastRouteRouter(); | ||
} | ||
} |
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.
Missing EOL EOF
|
||
use Interop\Container\ContainerInterface; | ||
use Zend\Expressive\Router\FastRouteRouter; | ||
|
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.
Too much empty lines
config/services.php
Outdated
@@ -45,7 +31,7 @@ | |||
return 'root'; |
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.
This values should come from environment variables,
config/services.php
Outdated
|
||
// @todo move repository to another file | ||
ConferenceRepositoryInterface::class => ConferenceRepositoryFactory::class, | ||
|
||
// @todo move db info to a class to get ENV vars | ||
'db_dsn' => function () { | ||
return 'mysql:host=localhost;dbname=conticket'; |
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.
This values should come from environment variables
/** | ||
* @author Luciano Queiroz <[email protected]> | ||
*/ | ||
final class ApplicationFactory |
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.
implements FactoryInterface
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.
Which FactoryInterface should be implemented? I didn't find one that matches our factories implementation
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.
I just want to avoid the maximum of duck type on code.
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.
perfect! 👍
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.
Also, I'm thinking about drop container-interop/container-interop
and use just PSR-11 instead. Not sure yet, seems like it'll be possible only when using SM4.0
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.
I think that's a good call, since https://github.com/container-interop/container-interop#deprecation-warning
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.
@lucianoqueiroz we can do that in subsequent PR, It's getting huge man. Is it done on your side? can I merge 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.
yes, you can
composer.json
Outdated
@@ -35,7 +35,8 @@ | |||
"ramsey/uuid": "^2.8", | |||
"zendframework/zend-expressive": "^1.0", | |||
"zendframework/zend-expressive-fastroute": "^1.0", | |||
"zendframework/zend-servicemanager": "^3.2" | |||
"zendframework/zend-servicemanager": "^3.2", | |||
"vlucas/phpdotenv": "^2.4" |
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.
--sort-packages
config/service-manager.php
Outdated
require __DIR__ . '/commands.php', | ||
require __DIR__ . '/middlewares.php', | ||
require __DIR__ . '/repositories.php', | ||
require __DIR__ . '/services.php' |
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.
Seems like you created a new line and deleted services.php
here.
Stay with services.php
at the top so the diff will be not affected by this.
config/services.php
Outdated
}, | ||
|
||
Application::class => ApplicationFactory::class, | ||
FastRouteRouter::class => InvokableFactory::class, |
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.
align the rest of the file to =>
public/index.php
Outdated
@@ -7,6 +7,9 @@ | |||
(function () { | |||
require __DIR__ . '/../vendor/autoload.php'; | |||
|
|||
/* loading .env variables */ |
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.
Unneeded comment.
public/index.php
Outdated
@@ -7,6 +7,9 @@ | |||
(function () { | |||
require __DIR__ . '/../vendor/autoload.php'; | |||
|
|||
/* loading .env variables */ | |||
(new \Dotenv\Dotenv(__DIR__ . '/..'))->load(); |
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.
Can't we use $app->pipe()
?
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.
I didn't get it... Are you saying to load the .env variables via a middleware and pipe it to run every request?
$container->get('db_dsn'), | ||
$container->get('db_user'), | ||
$container->get('db_password') | ||
getenv('DB_DSN'), |
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 SHALL still get this info from containers IMHO.
Register it under services
return 'root'; | ||
}, | ||
Application::class => ApplicationFactory::class, | ||
FastRouteRouter::class => InvokableFactory::class, |
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.
too much space
Thank you @lucianoqueiroz 🍻 |
related with #31 .