我在另一个symfony项目的同一目录中创建了一个symfony项目。这个旧项目的列类型为“phone_number”,使用另一个包。这个项目没有使用它。
我已经尝试删除composer.lock和供应商以及作曲家安装。我已经尝试过作曲家更新(我在lts上)。我试过手动和通过cli删除缓存。
出于某种原因,当我尝试运行app / console schema时:更新
[Doctrine\DBAL\DBALException]
Unknown column type "phone_number" requested. Any Doctrine type that you us
e has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can g
et a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMa
p(). If this error occurs during database introspection then you might have
forgot to register all database types for a Doctrine Type. Use AbstractPla
tform#registerDoctrineTypeMapping() or have your custom types implement Typ
e#getMappedDatabaseTypes(). If the type name is empty you might have a prob
lem with the cache or forgot some mapping information.
我的app / config / config.yml
# Doctrine Configuration
doctrine:
dbal:
default_connection: photoProject
connections:
photoProject:
driver: pdo_pgsql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: '%kernel.root_dir%/data/data.db 3'
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
#path: '%database_path%'
orm:
default_entity_manager: photoProject
entity_managers:
photoProject:
connection: photoProject
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
#auto_generate_proxy_classes: '%kernel.debug%'
doctrine_migrations:
dir_name: "%kernel.root_dir%/app/DoctrineMigrations"
namespace: Application\Migrations
table_name: migration_versions
name: Application Migrations
我甚至删除了旧项目,但仍然遇到了同样的错误。我认为这与自动加载旧数据库模式的某些缓存版本有关,但我不确定在哪里可以找到问题。
谢谢!
{
"name": "root/photoproject",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"": "src/"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
},
"autoload-dev": {
"files": [
"vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
]
},
"require": {
"php": ">=5.3.9",
"doctrine/annotations": "^1.4",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/doctrine-migrations-bundle": "^1.0",
"doctrine/migrations": "^1.5",
"doctrine/orm": "^2.5",
"egulias/email-validator": "^2.1",
"incenteev/composer-parameter-handler": "~2.0",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"symfony/monolog-bundle": "^3.0.2",
"symfony/swiftmailer-bundle": "~2.3,>=2.3.10",
"symfony/symfony": "2.8.*",
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-install-cmd": [
"@symfony-scripts"
],
"post-update-cmd": [
"@symfony-scripts"
]
},
"config": {
"bin-dir": "bin",
"sort-packages": true
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": null
}
}
答案 0 :(得分:0)
找到解决方案。我从旧项目中重用了完全相同的doctrine migration / db设置。我认为在我的数据库中有一个名为doctrine_migrations的表,不知怎的,当我运行任何错误输出时。
发布以防其他人看到它。查看您的数据库,看看您是否有一个旧迁移表。