donfanning
8/15/2018 - 1:25 PM

FOSUserBundleで作られるuserテーブルのスキーマが思ってたんとちがう場合に確認すること ref: http://qiita.com/pinekta/items/8ee7ca494f5eaac89d46

FOSUserBundleで作られるuserテーブルのスキーマが思ってたんとちがう場合に確認すること ref: http://qiita.com/pinekta/items/8ee7ca494f5eaac89d46

$ php app/console doctrine:schema:update --dump-sql
CREATE SEQUENCE user_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
CREATE TABLE "user" (id INT NOT NULL, username VARCHAR(255) NOT NULL, username_canonical VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, email_canonical VARCHAR(255) NOT NULL, enabled BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, locked BOOLEAN NOT NULL, expired BOOLEAN NOT NULL, expires_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, roles TEXT NOT NULL, credentials_expired BOOLEAN NOT NULL, credentials_expire_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id));
CREATE UNIQUE INDEX UNIQ_8D93D64992FC23A8 ON "user" (username_canonical);
CREATE UNIQUE INDEX UNIQ_8D93D649A0D96FBF ON "user" (email_canonical);
COMMENT ON COLUMN "user".roles IS '(DC2Type:array)';
<?php

namespace Hoge\FugaBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;    // ★マニュアルどおり
use Doctrine\ORM\Mapping as ORM;
$ composer require friendsofsymfony/user-bundle "~2.0@dev"
$ php app/console doctrine:schema:update --dump-sql
CREATE SEQUENCE user_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
CREATE TABLE "user" (id INT NOT NULL, username VARCHAR(255) NOT NULL, username_canonical VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, email_canonical VARCHAR(255) NOT NULL, enabled BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, locked BOOLEAN NOT NULL, expired BOOLEAN NOT NULL, expires_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, roles TEXT NOT NULL, credentials_expired BOOLEAN NOT NULL, credentials_expire_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id));
CREATE UNIQUE INDEX UNIQ_8D93D64992FC23A8 ON "user" (username_canonical);
CREATE UNIQUE INDEX UNIQ_8D93D649A0D96FBF ON "user" (email_canonical);
COMMENT ON COLUMN "user".roles IS '(DC2Type:array)';
<?php

namespace Hoge\FugaBundle\Entity;

//use FOS\UserBundle\Model\User as BaseUser;    // ★こうではなく
use FOS\UserBundle\Entity\User as BaseUser;     // ★こうする
use Doctrine\ORM\Mapping as ORM;
$ php app/console doctrine:schema:update --dump-sql
CREATE SEQUENCE user_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
CREATE TABLE "user" (id INT NOT NULL, PRIMARY KEY(id));
$ composer require friendsofsymfony/user-bundle