FOSHttpCacheBundle icon indicating copy to clipboard operation
FOSHttpCacheBundle copied to clipboard

Update to Symfony 7

Open toxicity1985 opened this issue 2 years ago • 14 comments

Hello,

I was testing to upgrade my applicaiton to symfony 7 but with no success. I try to update this pluging and launch php unit test but i'm facing some issue.

Once is related to the class "Symfony\Component\Routing\Loader\AnnotationClassLoader" who is not found. If i understand well this class is used by SensioFrameworkExtraBundle and has change with Symfony 7. So we have to switch with attributes this project or the best things is to make a pr on the SensioFrameworkExtraBundle project ? Do you need help for that.

Best regards.

Edit: I just see that the SensioFrameworkExtraBundle will not be maintained anymore.

toxicity1985 avatar Dec 11 '23 08:12 toxicity1985

yeah, annotations have been removed in Symfony 7, in favor of the attributes.

we need to provide our annotations as attributes as well. i am not sure about the error you get with AnnotationClassLoader, because nothing of FOSHttpCache directly uses that. maybe the sensio bundle has a bad composer.json.

we will also need to wrap up https://github.com/FriendsOfSymfony/FOSHttpCache/pull/549 which needs a new major version of the library. i think for the symfony bundle we don't need a new major, we should not need BC breaks.

dbu avatar Dec 11 '23 10:12 dbu

Yes. So we are waiting for the other bundle to be updated before working on it now ?

toxicity1985 avatar Dec 11 '23 10:12 toxicity1985

i worked on the library, hopefully the 3.x branch will soon allow symfony 7.

if you have time to work on it, it would be great to add attributes for the things we currently only have as annotations. we should be able to extend the annotation classes, see e.g. https://github.com/doctrine/phpcr-odm/pull/852/files#diff-90e805dabc3794deefaa3c8f78b4a2e45df5c1d7e6f204dc5805a046dbeae207 (look at the attribute classes , the whole diff is quite big because documentation and tests and all that)

dbu avatar Dec 11 '23 10:12 dbu

Yeah but i can start to check. I have a question for the namespace. Do we add two directory inside 'Configuration' folder like "Annotations" and "Attributes" ?

toxicity1985 avatar Dec 11 '23 11:12 toxicity1985

thanks! we can't move the annotations because that would be a BC break.

i suggest to create a new namespace Attributes at the top level of the bundle

dbu avatar Dec 11 '23 12:12 dbu

oh, i just notice: we already have the annotations also be attributes. but the problem is that they extend the framework extra bundle base class.

could we make them no longer extend that class? maybe we need to duplicate a small thing from the ConfigurationAnnotation but should not need too much

dbu avatar Dec 11 '23 12:12 dbu

so everything should be fine except we must not extend anything from framework extra bundle.

dbu avatar Dec 11 '23 12:12 dbu

Yes and change the doc. But it will be a bc break ?

toxicity1985 avatar Dec 11 '23 13:12 toxicity1985

as long as the annotations still work (when using older symfony versions) its not a BC break. people are not expected to extend that code with their own and rely on specific base classes.

dbu avatar Dec 11 '23 15:12 dbu

you should require fos http cache with 3.*@dev for now, the 3.* supports symfony 7. but needs a couple more cleanups before i can tag the release.

dbu avatar Dec 11 '23 16:12 dbu

Thanks. I'm working now on a version without SensioFrameworkExtraBundle. I will make a release when it's ok.

toxicity1985 avatar Dec 11 '23 16:12 toxicity1985

best do a pull request to this repository, then we can release it here.

dbu avatar Dec 11 '23 16:12 dbu

Anything that could be supported on this one?

usu avatar Jan 14 '24 12:01 usu

@usu if you have some time, you could pick up the branch of #610 and try to wrap things up. looks like toxicity1985 is quite busy at the moment.

dbu avatar Jan 15 '24 07:01 dbu

fixed in #611

dbu avatar Mar 21 '24 16:03 dbu