Feilong
Feilong

Reputation: 21

ERROR Class "User" doesn't exist; please enter an existing full class name. (Symfony)

I'm a noob and my english is very bad but I will try to explain my problem.

I started a new side-project to train in Symfony. I install multiple composer like : profiler, maker, orm, template...

 updated: src/Entity/User.php

 Add another property? Enter the property name (or press <return> to stop adding fields):
 >

  Success!

 Next: When you're ready, create a migration with php bin/console make:migration

frede@DESKTOP-M7PFMDG /c/xampp/htdocs/side_project/01-rpg_builder (registration)
λ php bin/console make:migration

  Success!

 Next: Review the new migration "migrations/Version20200625073423.php"
 Then: Run the migration with php bin/console doctrine:migrations:migrate
 See https://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html
frede@DESKTOP-M7PFMDG /c/xampp/htdocs/side_project/01-rpg_builder (registration)
λ php bin/console doctrine:migrations:migrate

 WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
 >

[notice] Migrating up to DoctrineMigrations\Version20200625073423
[notice] finished in 91.2ms, used 18M memory, 1 migrations executed, 1 sql queries

frede@DESKTOP-M7PFMDG /c/xampp/htdocs/side_project/01-rpg_builder (registration)
λ php bin/console make:auth

 What style of authentication do you want? [Empty authenticator]:
  [0] Empty authenticator
  [1] Login form authenticator
 > 1
1

 The class name of the authenticator to create (e.g. AppCustomAuthenticator):
 > AppAuthenticator

 Choose a name for the controller class (e.g. SecurityController) [SecurityController]:
 >

 Enter the User class that you want to authenticate (e.g. App\Entity\User) []:
 > User

 [ERROR] Class "User" doesn't exist; please enter an existing full class name.

I have never had this kind of problem before. I think it's since update doctrine-migrations-bundle "2.1.2" to "3.0.1"

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.2.5",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "sensio/framework-extra-bundle": "^5.5",
        "symfony/asset": "5.1.*",
        "symfony/console": "5.1.*",
        "symfony/dotenv": "5.1.*",
        "symfony/flex": "^1.8",
        "symfony/framework-bundle": "5.1.*",
        "symfony/orm-pack": "^1.0",
        "symfony/profiler-pack": "^1.0",
        "symfony/security-bundle": "5.1.*",
        "symfony/twig-pack": "^1.0",
        "symfony/validator": "5.1.*",
        "symfony/yaml": "5.1.*"
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.3",
        "symfony/maker-bundle": "^1.19"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "5.1.*"
        }
    }
}

doctrine_migrations:
    migrations_paths:
        # namespace is arbitrary but should be different from App\Migrations
        # as migrations classes should NOT be autoloaded
        'DoctrineMigrations': '%kernel.project_dir%/migrations'
doctrine:
    dbal:
        url: '%env(resolve:DATABASE_URL)%'

        # IMPORTANT: You MUST configure your server version,
        # either here or in the DATABASE_URL env var (see .env file)
        #server_version: '5.7'
    orm:
        auto_generate_proxy_classes: true
        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
        auto_mapping: true
        mappings:
            App:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/Entity'
                prefix: 'App\Entity'
                alias: App

thank you very much for reading me.

Upvotes: 0

Views: 3223

Answers (1)

Feilong
Feilong

Reputation: 21

Obviously I wrong create my entity User. I make:entity User instead of make:user

Upvotes: 2

Related Questions