Search code examples
phpsymfonydoctrine-ormfosuserbundle

Symfony migration empty with FOSUserBundle


I have a Symfony 4 app that has used the Symfony\Component\Security\Core\User\UserInterface to implement the class to define my User.php entity.

I now installed and configured the FOSUserBundle, and changed my entity class to extend the BaseUser class.

<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as BaseUser;

/**
 * @ORM\Entity
 * @ORM\Table(name="`user`")
 */
class User extends BaseUser
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=180, unique=true)
     */
    public function getId()
    {
        return $this->id;
    }
}

However now when I run php bin/console doctrine:migrations:genrate then doctrine:migrations:migrate I get:

"Migration was executed but did not result in any SQL statements".

My config (in framework.yaml) is:

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: App\Entity\User
    service:
        mailer: fos_user.mailer.twig_swift
    from_email:
        address: "hello@example.com"
        sender_name: "JW-App Mailer"

The migrations version is saving to the db, but not the user entity. Is there something in my User.php entity causing the issue?


Solution

  • I was able to update the schema by using bin/console doctrine:migrations:diff and then using bin/console doctrine:schema:update --force.