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

Register commands using PSR-4 based Service Discovery #684

Closed
wants to merge 3 commits into from
Closed

Register commands using PSR-4 based Service Discovery #684

wants to merge 3 commits into from

Conversation

GuilhemN
Copy link

@GuilhemN GuilhemN commented Aug 6, 2017

Commands auto-registration will be deprecated soon (see symfony/symfony#23805) so we need to stop using it.

@GuilhemN GuilhemN changed the title Register commands use PSR-4 based Service Discovery Register commands using PSR-4 based Service Discovery Aug 6, 2017

$prototype = new Definition();
$prototype
->setPublic(False)
Copy link
Contributor

Choose a reason for hiding this comment

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

wrong case

Copy link
Author

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

Choose a reason for hiding this comment

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

Version::class

Copy link
Author

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

Choose a reason for hiding this comment

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

Please add __DIR__

Copy link
Author

Choose a reason for hiding this comment

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

done

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

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

Copy link
Author

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.

Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

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

ok, done

@Ocramius
Copy link
Member

Ocramius commented Aug 6, 2017

@GuilhemN the commit messages: make them descriptive, please

@GuilhemN
Copy link
Author

GuilhemN commented Aug 6, 2017

@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')) {
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

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

indeed, updated

Copy link
Member

@Ocramius Ocramius left a 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?

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

Choose a reason for hiding this comment

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

Version::class

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@kimhemsoe
Copy link
Member

Are we OK with dropping support for sf2.7?
Seems to me that it would be possible to support 3.4 without dropping support for 2.7 without much trouble.

@kimhemsoe
Copy link
Member

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?

@GuilhemN
Copy link
Author

GuilhemN commented Aug 8, 2017

Are we OK with dropping support for sf2.7?
Seems to me that it would be possible to support 3.4 without dropping support for 2.7 without much trouble.

@Ocramius told me it was ok (#684 (comment)).

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?

Indeed I had to bump symfony/framework-bundle and symfony/yaml.

@kimhemsoe kimhemsoe added this to the 1.8.0 milestone Aug 8, 2017
@Ocramius
Copy link
Member

Ocramius commented Aug 8, 2017

@kimhemsoe yeah, dropping symfony 2.x and <3.3 is perfectly OK for new improvement releases.

@kimhemsoe
Copy link
Member

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

@GuilhemN
Copy link
Author

GuilhemN commented Aug 9, 2017

symfony/symfony#23805 has been merged :)

@chalasr
Copy link
Contributor

chalasr commented Aug 11, 2017

DI <3.3 layers should be removed once this merged.

@Ocramius
Copy link
Member

@kimhemsoe please rebase instead

@kimhemsoe
Copy link
Member

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)) {
Copy link
Contributor

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.

@nicolas-grekas
Copy link
Member

can be closed

@fabpot fabpot closed this Oct 13, 2017
@GuilhemN GuilhemN deleted the commands branch May 31, 2020 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants