Skip to content
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

Merged
merged 11 commits into from
Mar 8, 2017
Merged

Conversation

lucianoqueiroz
Copy link

related with #31 .

Copy link
Member

@malukenho malukenho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job 👏

use Prooph\EventStore\EventStore;
use Prooph\ServiceBus\CommandBus;
use Zend\Expressive\Application;
use Zend\Expressive\Router\FastRouteRouter;


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this new line

},

Application::class => ApplicationFactory::class,
FastRouteRouter::class => RouterFactory::class,
Copy link
Member

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.

@@ -45,7 +31,7 @@
return 'root';
},
'db_password' => function () {
return 'root';
return null;
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline arguments

@@ -0,0 +1,14 @@
<?php

Copy link
Member

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 <luciiano.queiroz@gmail.com>
*/
final class RouterFactory
Copy link
Member

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();
}
}
Copy link
Member

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;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too much empty lines

@@ -45,7 +31,7 @@
return 'root';
Copy link
Member

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,


// @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';
Copy link
Member

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 <luciiano.queiroz@gmail.com>
*/
final class ApplicationFactory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implements FactoryInterface

Copy link
Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect! 👍

Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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?

Copy link
Author

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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--sort-packages

require __DIR__ . '/commands.php',
require __DIR__ . '/middlewares.php',
require __DIR__ . '/repositories.php',
require __DIR__ . '/services.php'
Copy link
Member

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.

},

Application::class => ApplicationFactory::class,
FastRouteRouter::class => InvokableFactory::class,
Copy link
Member

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 */
Copy link
Member

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();
Copy link
Member

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()?

Copy link
Author

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'),
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too much space

@malukenho malukenho merged commit b2e51bd into PHPeste:inhancement/#31 Mar 8, 2017
@malukenho
Copy link
Member

Thank you @lucianoqueiroz 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants