-
-
Notifications
You must be signed in to change notification settings - Fork 448
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
Register commands using PSR-4 based Service Discovery #684
Conversation
|
||
$prototype = new Definition(); | ||
$prototype | ||
->setPublic(False) |
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.
wrong case
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.
Indeed, fixed
@@ -72,6 +72,20 @@ public function load(array $configs, ContainerBuilder $container) | |||
|
|||
$this->adapter->loadServicesConfiguration($container); | |||
|
|||
// Use the default logic when the ORM is available. | |||
// This avoids listing all ORM commands by hand. | |||
if (class_exists('Doctrine\ORM\Version') && method_exists(XmlFileLoader::class, 'registerClasses')) { |
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.
Version::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.
done
->addTag('console.command') | ||
; | ||
|
||
$loader->registerClasses($prototype, 'Doctrine\Bundle\DoctrineBundle\Command\\', '../../Command/*'); |
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.
Please add __DIR__
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.
done
DoctrineBundle.php
Outdated
@@ -143,7 +144,10 @@ public function registerCommands(Application $application) | |||
// Use the default logic when the ORM is available. | |||
// This avoids listing all ORM commands by hand. | |||
if (class_exists('Doctrine\\ORM\\Version')) { | |||
parent::registerCommands($application); | |||
if (!method_exists(FileLoader::class, 'registerClasses')) { | |||
// BC sf < 3.3 |
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.
Could bump the dependency instead
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.
Is it ok? It will forbid using sf 2.x.
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, that is OK. This is not a bugfix, so it will land in the next minor anyway
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.
ok, done
@GuilhemN the commit messages: make them descriptive, please |
@Ocramius I rebased, these commits were just here so you could know the changes I've done, they didn't bring much value otherwise. |
@@ -72,6 +72,20 @@ public function load(array $configs, ContainerBuilder $container) | |||
|
|||
$this->adapter->loadServicesConfiguration($container); | |||
|
|||
// Use a prototype when the ORM is available. | |||
// This avoids listing all ORM commands by hand. | |||
if (class_exists(Version::class) && method_exists(XmlFileLoader::class, 'registerClasses')) { |
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.
&& method_exists(XmlFileLoader::class, 'registerClasses')
part of the condition could be removed now that the DI dependency has been bumped to 3.3.
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.
indeed, updated
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.
Besides nitpicks, LGTM 👍
@kimhemsoe can you check on which milestone this has to land?
DoctrineBundle.php
Outdated
@@ -140,11 +140,8 @@ public function shutdown() | |||
*/ | |||
public function registerCommands(Application $application) | |||
{ | |||
// Use the default logic when the ORM is available. | |||
// This avoids listing all ORM commands by hand. | |||
if (class_exists('Doctrine\\ORM\\Version')) { |
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.
Version::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.
fixed
Are we OK with dropping support for sf2.7? |
Sorry, we pull in symfony/dependency-injection 3.3, which require finder, config and yaml to be 3.3 if installed, if i am correct? Is that any nasty surprises here? Like is that any issues with console which yaml require to be 3.3? |
@Ocramius told me it was ok (#684 (comment)).
Indeed I had to bump symfony/framework-bundle and symfony/yaml. |
@kimhemsoe yeah, dropping symfony 2.x and <3.3 is perfectly OK for new improvement releases. |
OK i will try to get the last bug fix in for a 1.7 release then. And then we set this for 1.8 |
symfony/symfony#23805 has been merged :) |
DI <3.3 layers should be removed once this merged. |
@kimhemsoe please rebase instead |
Will do, also need to fix that travis failure we have. Hmm.. did not see that the edit ended up with a merge. |
@@ -73,6 +73,20 @@ public function load(array $configs, ContainerBuilder $container) | |||
|
|||
$this->adapter->loadServicesConfiguration($container); | |||
|
|||
// Use a prototype when the ORM is available. | |||
// This avoids listing all ORM commands by hand. | |||
if (class_exists(Version::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.
This type of check should be avoided since Version class is being removed in 3.0, see doctrine/orm#6653.
Probably good enough for now (already used in registerCommands()), but should be handled differently in future.
can be closed |
Commands auto-registration will be deprecated soon (see symfony/symfony#23805) so we need to stop using it.