-2

I've been trying to upgrade our site from Symfony 4.4 to 5.0. I finally resolved all the composer dependencies and now I'm getting these errors:


  The file "../src/Controller/" does not exist (in: "/home/avrsites/websites/xxxx.com/symfony/config/routes") in ../src/Controller/ (which i
  s being imported from "/home/avrsites/websites/xxxx.com/symfony/config/routes/routes.yaml"). Make sure annotations are installed and enabl
  ed.


In FileLocator.php line 71:

  The file "../src/Controller/" does not exist (in: "/home/avrsites/websites/xxxx.com/symfony/config/routes").

Nothing in my routing config has changed and everything runs fine on 4.4. This is a fairly complex set up and it has two hosts running on the same Symfony project (one of them uses API Platform and runs on a separate subdomain).

Annotation is enabled, so I have a feeling that this error message is misleading and the actual problem is something else.

lfjeff
  • 1,840
  • 2
  • 17
  • 19
  • Consider searching for something like "The file "../src/Controller/" does not exist". I have seen that sort of message pop up in various questions, usually with different resolutions. And make sure you are using the latest php 7.4.4. Some of the earlier php versions had preloading issues which generated mysterious error messages. – Cerad Apr 07 '20 at 14:22
  • The message is generated in the Symfony `http-foundation/File/Exception/FileNotFoundException.php` file. So far, this is not very helpful as `FileNotFoundException` is used in a number of locations. Am trying to track it down a little deeper. – lfjeff Apr 07 '20 at 17:49
  • In this case, by search I meant an internet search. – Cerad Apr 07 '20 at 18:07
  • I tried that earlier and didn't find anything useful. Now I've created a fresh install of Symfony 5 and am comparing the virgin config files on that project to my current project. – lfjeff Apr 07 '20 at 18:18

1 Answers1

0

I finally figured it out...

In my config/routes/routes.yaml file, I had to make the following change:

resource: '../src/Controller/'

to

resource: '../../src/Controller/'

and a similar change in my config/routes/dev/routes.yaml file of:

resource: '../../src/Controller/`

to

resource: '../../../src/Controller/`

This fixed the errors above, but I still encountered a few other issues also made these changes to config/routes/dev/twig.yaml:

resource: '@TwigBundle/Resources/config/routing/errors.xml'

to

resource: '@FrameworkBundle/Resources/config/routing/errors.xml

To fix other errors, I also copied the public/index.php and config/bootstrap.php files from a brand-new Symfony 5 project.

Now my project compiles and I'm testing to make sure everything still works correctly.

lfjeff
  • 1,840
  • 2
  • 17
  • 19
  • Glad you got it working. Anytime I have move up a major version I always create a fresh project from scratch, get all my third party bundles installed and use it a starting point. – Cerad Apr 07 '20 at 19:46
  • Things are still not working 100%, but I'm getting closer. Now I'm looking at errors in the log file and making code fixes (mostly minor ones, so far). – lfjeff Apr 07 '20 at 19:50