Conversation
| use Zend\Expressive\Application; | ||
| use Zend\Expressive\Router\FastRouteRouter; | ||
|
|
||
|
|
config/services.php
Outdated
| }, | ||
|
|
||
| Application::class => ApplicationFactory::class, | ||
| FastRouteRouter::class => RouterFactory::class, |
There was a problem hiding this comment.
FastRouter doesn't need a specialised class for factory, I guess you can use the InvokableFactory::class in this situations.
config/services.php
Outdated
| }, | ||
| 'db_password' => function () { | ||
| return 'root'; | ||
| return null; |
There was a problem hiding this comment.
It need to be changed, this values should come from environment variables
| \DateTimeImmutable $date | ||
| ): self { | ||
| return new self( | ||
| $conferenceId, |
| @@ -0,0 +1,14 @@ | |||
| <?php | |||
|
|
|||
| /** | ||
| * @author Luciano Queiroz <luciiano.queiroz@gmail.com> | ||
| */ | ||
| final class RouterFactory |
There was a problem hiding this comment.
Kill this class as mentioned above
| { | ||
| return new FastRouteRouter(); | ||
| } | ||
| } No newline at end of file |
|
|
||
| use Interop\Container\ContainerInterface; | ||
| use Zend\Expressive\Router\FastRouteRouter; | ||
|
|
config/services.php
Outdated
| @@ -45,7 +31,7 @@ | |||
| return 'root'; | |||
There was a problem hiding this comment.
This values should come from environment variables,
config/services.php
Outdated
|
|
||
| // @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.
This values should come from environment variables
| /** | ||
| * @author Luciano Queiroz <luciiano.queiroz@gmail.com> | ||
| */ | ||
| final class ApplicationFactory |
There was a problem hiding this comment.
Which FactoryInterface should be implemented? I didn't find one that matches our factories implementation
There was a problem hiding this comment.
This one: https://github.com/zendframework/zend-servicemanager/blob/master/src/Factory/FactoryInterface.php
I just want to avoid the maximum of duck type on code.
There was a problem hiding this comment.
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.
I think that's a good call, since https://github.com/container-interop/container-interop#deprecation-warning
There was a problem hiding this comment.
@lucianoqueiroz we can do that in subsequent PR, It's getting huge man. Is it done on your side? can I merge it?
composer.json
Outdated
| "zendframework/zend-expressive-fastroute": "^1.0", | ||
| "zendframework/zend-servicemanager": "^3.2" | ||
| "zendframework/zend-servicemanager": "^3.2", | ||
| "vlucas/phpdotenv": "^2.4" |
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.
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.
align the rest of the file to =>
public/index.php
Outdated
| (function () { | ||
| require __DIR__ . '/../vendor/autoload.php'; | ||
|
|
||
| /* loading .env variables */ |
| require __DIR__ . '/../vendor/autoload.php'; | ||
|
|
||
| /* loading .env variables */ | ||
| (new \Dotenv\Dotenv(__DIR__ . '/..'))->load(); |
There was a problem hiding this comment.
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.
It SHALL still get this info from containers IMHO.
Register it under services
| return 'root'; | ||
| }, | ||
| Application::class => ApplicationFactory::class, | ||
| FastRouteRouter::class => InvokableFactory::class, |
|
Thank you @lucianoqueiroz 🍻 |
related with #31 .