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
Port commands for Symfony 4.2 (follows #876) #877
Conversation
f9e03e8
to
6901617
Compare
It looks like dependencies are not injected for SF 2.8 and 3.2, any idea of what's going on (@chalasr maybe)? |
All green |
Is this ready? |
it is. Just beware of the tiny BC break: commands don't extend |
Are we still exposing the methods from ContainerAwareCommand or are those no longer there? Wondering about the impact of the BC break. How did Symfony take care of this? |
@alcaeus no, they are not exposed anymore. Symfony core commands stopped extending this class in 3.4 but kept a BC layer until 4.0 which was:
It could be worth using the same approach here. |
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.
We either need to make master 2.0.x-dev before merging this or make these changes backwards compatible. These classes are covered by the BC promise.
@chalasr, as far as I understand, what you suggest limit the BC break, but doesn’t prevent it totally: To limit the BC break, I’ve marked the commands as final (but it hasn’t been done in an earlier release, it’s kind of useless for the next version). Bumping the major version just for that looks a bit overkill, but it’s the only solution I have in mind to be fully semver compliant. |
Agree on making the classes "final" using I also agree that tagging a major version for this is overkill, but I'm worried about breaking BC. This could happen if someone extended the commands in their projects and relied on |
@weaverryan Is this BC break ok with you guys? |
f069ec6
to
489e5d3
Compare
BC layer added, PR rebased. Ready on my side (build failure seems unrelated) |
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 fix coding standard violations. I restarted the stage manually, you can see it here: https://travis-ci.org/doctrine/DoctrineBundle/jobs/461744294
Command/DoctrineCommand.php
Outdated
*/ | ||
public function setContainer(ContainerInterface $container = null) | ||
{ | ||
@trigger_error(sprintf('The "%s()" method is deprecated and will be removed in DoctrineBundle 2.0.', __METHOD__), E_USER_DEPRECATED); |
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.
As per Doctrine's Deprecation Policy, silenced deprecations should not be used - @deprecated
annotation should be used 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.
Since we're dealing with a Symfony Bundle here, it makes sense to use the Symfony way of dealing with deprecations, don't you think?
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.
Note that silenced deprecations are used elsewhere in the code base already.
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.
don't you think?
Not convinced, just like with CS - it sits under Doctrine GH org. We had this discussion many times already, with @Ocramius too.
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 I won't fight here, deprecation notices removed.
489e5d3
to
c94a199
Compare
@Majkl578 CS fixed, thanks. |
c94a199
to
b69d78a
Compare
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.
Thanks @chalasr!
@kimhemsoe thanks for the merge! Can you tag a release too please (Symfony 4.2 has been released, so the current version triggers deprecations). |
@dunglas Done :) |
Follows (and needs) #876.
It works, but it introduces several BC breaks:
ContainerAwareCommand
anymore (as this class is deprecated)Making the commands fully BC would be possible by using hacks like this one to introduce some conditional inheritance, but I'm not sure that it is worth it:
ContainerAwareCommand
commands were designed to be initialized by the framework itself.Also, to prevent future similar issues, I marked these commands
@final
, and the abstractDoctrineCommand
as@internal
.