简体   繁体   中英

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?

我能够通过使用bin/console doctrine:migrations:diff然后使用bin/console doctrine:schema:update --force

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM