I'm trying a school project in Symfony but I'm getting an error that stopped me for several hours, I couldn't find any answer so I hope someone of you can help me.
I'm trying to set a view for a user registration with a form, I've follow some Symfony cookbook guides but couldn't reach to the end.
I'll put you on situation, I have a bundle with the default controller where I have put by now all functions that render a view, but I want to do it better and to have various controllers to have a better organization.
I've created a controller called: AccountControler.php which is in // src/AppBundle/Controller/AccountController.php
<?php
// src/AppBundle/Controller/AccountController.php
namespace AdrianG\RegisterBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use AdrianG\RegisterBundle\Form\UserType;
use AdrianG\RegisterBundle\Entity\User;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class RegistrationController extends Controller
{
/**
* @Route("/register", name="user_registration")
*/
public function registerAction(Request $request)
{
//....
I think the routing is correct:
user_registration:
pattern: /register
defaults: { _controller: AdrianGRegisterBundle:Account:register}
and I'm getting an error when trying to access
localhost/symfony8/web/app_dev.php/user/register
The autoloader expected class "AdrianG\RegisterBundle\Controller\AccountController" to be defined in file "/Applications/AMPPS/www/symfony8/src/AdrianG/RegisterBundle/Controller/AccountController.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
I'm able to access to anywhere with my routes and with DefaultController.php I 've search and people says about namespace ( ¿I think its correct no? ) or about <? that should be <?php
I really don't know what can be the problem and some help would be really nice
EDIT: DefaultController.php and AccountControler.php are in the same folder, and they have the same namespace, should it be so?