Skip to content

Frequently Encountered Errors

Daniel Molares edited this page Jan 15, 2025 · 5 revisions

Changing Controller Code and Route Not Found

During your stint of development on UDOIT, you will inevitably have to either change some code relating to an existing controller or add a new controller for some specific purpose. Upon doing either of those things, you will inevitably run into an error where your changes are either not registered, the dependency which you have injected is not recognized, or the newly added controller itself is not accessible. The solution for this issue is to clear the cache that Symfony sets up when you run your instance of UDOIT. If you are using Docker to run UDOIT, then simply run your database image, cd into your UDOIT repository, and run the following command in your terminal:

docker-compose -f docker-compose.nginx.yml run php bin/console cache:clear

Fatal error: Declaration of Container[some string]\EntityManager_[some string]::refresh($entity) must be compatible...

Sometimes, your application will not run because a cache container might not be up to date with some newer packages that you have installed using composer. To fix this issue, simply go into the var/cache/prod folder and delete the container that is giving you trouble (an example name for a container is ContainerQBhi7Mt). Don't worry about deleting it as an updated container will sprout back out with the updated code.

Printing out content to the terminal

Printing out content to the terminal using Symfony is shockingly not that straightforward. One way that we found to work would be to use the ConsoleOutput object. To do that, import ConsoleOutput using Symfony\Component\Console\Output\ConsoleOutput and instantiate a new instance of the object by typing $output = new ConsoleOutput(); in your function. Print information using the $output->writeln() method.

500 Error

When attempting to load UDOIT in your LMS, it is possible you get a 500 error before it even loads. Check your logs in the terminal where you ran the containers. If all you see is a call that returns 500, you might have some errors in the LTI or API keys that need fixing. One of the most common errors linked to this involves the LTI key sometimes changing your redirect URI from

<YOUR_UDOIT_BASE_URL>/lti/authorize/check

to

<YOUR_UDOIT_BASE_URL>/dashboard

Make sure to change it back to ensure UDOIT loads as intended.