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 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化