错误类别“;“用户”;不';不存在;请输入现有的完整类名。(Symfony)
我是个书呆子,我的英语很差,但我会尽力解释我的问题 我开始了一个新的副业项目,在Symfony训练。 我安装了多个编写器,如:分析器、生成器、orm、模板错误类别“;“用户”;不';不存在;请输入现有的完整类名。(Symfony),symfony,doctrine-orm,Symfony,Doctrine Orm,我是个书呆子,我的英语很差,但我会尽力解释我的问题 我开始了一个新的副业项目,在Symfony训练。 我安装了多个编写器,如:分析器、生成器、orm、模板 第一个问题: 元数据存储不是最新的,请运行sync metadata storage命令来解决此问题。 我通过将serverVersion改为.env.local解决了这个问题:?serverVersion=10.4.11-MariaDB 第二个问题是当我使用命令lign: php-bin/console-make:entity-User
- 第一个问题:
元数据存储不是最新的,请运行sync metadata storage命令来解决此问题。
我通过将serverVersion改为.env.local解决了这个问题:?serverVersion=10.4.11-MariaDB
- 第二个问题是当我使用命令lign:
php-bin/console-make:entity-User
没关系,但当我想要make:auth或make:registrationForm时,他让我输入用户类,我做了什么,我总是出现相同的错误:
[ERROR]类“User”不存在;请输入现有的完整类名。
我的命令lign看起来像:
- 原则_migrations.yaml:
- 亚马尔先生
非常感谢您阅读我的文章。显然我创建实体用户时出错了。
我使用make:entity User而不是make:User使用全名,包括名称空间。您的意思是:
App\entity\User
?我已经试过了,但也没用
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.
{
"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