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

Fix deprecations in fixture command #285

Merged
merged 3 commits into from Jun 12, 2019
Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Jun 12, 2019

Supersedes #283.

This PR:

  • fixes an invalid call to DoctrineCommand::__construct on lower DoctrineBundle versions
  • removes a call to the deprecated getContainer() method if the getDoctrine() method is present.

Since this is a bugfix release for 3.2, the dependency to DoctrineBundle can't really be bumped, as it will simply make this bugfix ineligible during version resolution for users of older DoctrineBundle versions. Thus, we work with method_exists to ensure the calls are handled correctly, removing this workaround in the next minor release where we'll properly bump the DoctrineBundle dependency.

@alcaeus alcaeus added the Bug label Jun 12, 2019
@alcaeus alcaeus added this to the 3.2.1 milestone Jun 12, 2019
@alcaeus alcaeus self-assigned this Jun 12, 2019
@alcaeus alcaeus changed the base branch from master to 3.2 June 12, 2019 09:53
@@ -38,7 +39,8 @@ public function __construct(SymfonyFixturesLoader $fixturesLoader, ?ManagerRegis
), E_USER_DEPRECATED);
}

parent::__construct($doctrine);
// @todo The method_exists call can be removed once the DoctrineBundle dependency has been bumped to at least 1.10
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 you bump the dependency and release a new minor instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

That would still leave a broken version for people on older versions of DoctrineBundle, which I'd like to avoid.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough, as long as this diff does get changed when merging up 👍

@alcaeus alcaeus merged commit e814837 into doctrine:3.2 Jun 12, 2019
@alcaeus alcaeus added this to 3.2 in Roadmap Jun 12, 2019
$doctrine = $this->getContainer()->get('doctrine');
$em = $doctrine->getManager($input->getOption('em'));
// @todo The method_exists call can be removed once the DoctrineBundle dependency has been bumped to at least 1.10
if (method_exists($this, 'getDotrine')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

getDotrine? 😏

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh come on...

Copy link
Member

Choose a reason for hiding this comment

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

Ouch... also didn't see this :S

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed 🙄

Copy link
Member Author

Choose a reason for hiding this comment

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

@Ocramius I'm still working on tests that manage to get to that point in the functionality. Will most likely end with completely changing the command in 4.0...

@alcaeus alcaeus deleted the fix-deprecations branch June 12, 2019 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants