-
Notifications
You must be signed in to change notification settings - Fork 702
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
Conditionally stop extending from the SensioFrameworkExtraBundle's Template annotation class #2401
Conversation
82500c7
to
a496779
Compare
Thank you for working on this! I just applied the changes to my own project which doesn't use any |
@goetas What's your opinion? Do you consider this a "soft" BC break or must this PR be part of the next major release? |
Hi guys. I'm not developing this, but I'm on the lookout. And looking forward to using this bundle in Symfony v7 :) |
You could declare the class conditionally based on whether or not the |
a496779
to
8b93e6f
Compare
Yeah, that looks to work. PR updated. (The failing CI can be dealt with when we've got a plan of action because the failures are all related to the PHPUnit bridge and the deprecation reporting, including Symfony 6.4 added deprecations) |
We could disable the Deprecation helper via:
or
|
8b93e6f
to
f33a6f3
Compare
I think I'm just gonna leave it be for the moment. I added the |
I think for PHP 8.2 it would be required to be strategy:
matrix:
include:
- php-version: 8.2
composer-flags: ""
can-fail: true # we don't want to fail the build if we are incompatible with the next (unstable) Symfony version
env:
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=104&max[indirect]=243'
- name: "Run PHPUnit"
if: "${{ matrix.coverage != '' }}"
run: |
XDEBUG_MODE=coverage ./phpunit --coverage-clover=coverage.clover
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
env: ${{ matrix.env }}
- name: "Run PHPUnit"
if: "${{ matrix.coverage == '' }}"
run: "./phpunit"
env: ${{ matrix.env }} |
f33a6f3
to
0f267a3
Compare
I wasn't even thinking about the indirect 🤦
|
That looks great. Maybe @goetas can give it a review now :) |
Thanks for the great work done here. This is the only dependency that I have pending in several projects to update finally to 7.0. All seems in place, any ETA to merge this soon? I would love a new release or at least a official dev branch to pick it. I am sure that when this gets released a lot projects will bump to SF 7.0 |
@mbabker thanks for the great work as usual! (and @alexander-schranz thanks for pinging me on this) |
Hi @mbabker, I just updated to the latest release and get some issues as "there are no registered paths for namespace FOSRest" (from twig) which is fixable via The searched for other issue I had: it seems that the serializer was not invoked or something involving twig as the error was something like Not sure if it was the intended solution though. 🤔 Thank you again for the work. |
Admittedly I've never used either this bundle's (The one thing I can think of that might affect it is that I did change the event listener priority order with this PR, so maybe the comment that used to be there about needing to run before the Sensio bundle's template listener still applies and the fix is to bump back up the priority? And if that's the case, it'd be good to have a functional test covering that so it doesn't break again as long as there's an explicit compat layer with that bundle in place.) |
Hello, I just do the update and got the same issue : Looks like the _template is set on the request attributes (with a weird .json.twig file) where it should not (the route return an Object and should not rely on template)? |
I think it's because of this change : https://github.com/FriendsOfSymfony/FOSRestBundle/pull/2401/files#diff-2359bb4681ba7bf807bf836fd67da56e5983f70efdc2bcca29768026d4c2352cR173 |
Yes, that's exactly what I was talking about but with more details. 😊 I will try to dig a bit more next week. |
Ref: #2354
With SensioFrameworkExtraBundle being deprecated and not compatible with Symfony 7, one of the things that has to be fixed to achieve Symfony 7 compatibility is breaking the reliance on that bundle for this bundle's
@View
annotation/attribute. That is accomplished with this PR by breaking the class inheritance and rewiring the event subscriber processing the annotation to work without the features from the SensioFrameworkExtraBundle.This includes a hard B/C break by removing the class inheritance, the@View
annotation class would no longer pass aclass_exists(Sensio\Bundle\FrameworkExtraBundle\Configuration\Template::class);
check as a result of this change. That's honestly a very low-risk change for downstream users, but has to be pointed out anyway. Maybe a bit higher risk is the fact that not all of the methods from the parent class are provided (as most of them are (rightfully) oriented toward rendering a template, which the event subscriber doesn't support).As suggested later in this thread, the B/C break is mitigated by using conditional inheritance, so the
@View
annotation will continue extendingSensio\Bundle\FrameworkExtraBundle\Configuration\Template
when the class is present and the hard break can be delayed to 4.0.