I am using Symfony 3.4 and when I'm trying to run server there is an error:
In RegisterControllerArgumentLocatorsPass.php line 68:
Class "AppBundle\Controller\HomeController" used for service "AppBundle\Controller\HomeController" cannot be found.
How can I deal with this problem?
The same error manifests when a controller extends Symfony's AbstractController
and does not import it.
Solved by adding the import to the controller:
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class HomeController extends Controller
{
/**
* @Route('/')
* @return \Symfony\Component\HttpFoundation\Response
*/
public function indexAction()
{
return $this->render('home/index.html.twig');
}
}
Exception thrown when handling an exception (Symfony\Component\Config\Exception\FileLoaderLoadException: [Syntax Error] Expected PlainValue, got ''' at position 7 in method AppBundle\Controller\HomeController::indexAction() in /home/remas/relevium_symfony/src/AppBundle/Controller/ (which is being imported from "/home/remas/relevium_symfony/app/config/routing.yml"). Make sure annotations are installed and enabled.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With