duanping3587 2018-10-06 12:43
浏览 44
已采纳

使用FOSUserBundle清空Symfony

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?

  • 写回答

1条回答 默认 最新

  • doumengxue7371 2018-10-15 14:33
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 chaquopy python 安卓
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题