As per comment, Symfony 3 uses either PSR-0 or PSR-4. Assuming that you’re using Composer, you configure which one to support in your composer.json
file.
With PSR-4, your filenames must correspond to your class names, and your directory names must match your namespaces. So if your entity is called FloydWarshall
in the namespace AppBundle\Entity
:
- it must be in the directory
src/AppBundle/Entity
- the file must be called
FloydWarshall.php
The reason for this strictness is the autoloader which comes with Composer. When you do new AppBundle\Entity\FloydWarshall
, the autoloader knows where to find the file for that class. In your case, you had named it fw.class.php
so the autoloader couldn’t find it.
Tangentially to the question, are you using the dev
environment? If you are, Symfony will give you a very helpful error message which will help you to diagnose the problem much quicker.
solved Internal Erro 500 when using class in symfony 3