Installing FOSUserBundle I got the following error when trying to access /register:
Class 'AppBundle\Entity\User' not found
Well, here is the User entity, which is under /src/Entity/User.php:
namespace AppBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="`user`")
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function __construct()
{
parent::__construct();
}
}
Otherwise, FOS was able to generate the user table on the db and also all the routes were created.
Also FOS's /login route works fine insofar as it shows the login form.
FOS's configuration is under /config/packages/fos_user.yaml and looks like this:
fos_user:
db_driver: orm
firewall_name: main
user_class: AppBundle\Entity\User
from_email:
address: "my.email@example.com"
sender_name: "myname"
Any ideas? Thanks
Your namespace specify an AppBundle but you say that your file is in /src/Entity/User.php
.
Put it in /src/AppBundle/Entity/User.php
and you should be good.