如何解决 symfony 学说:构建架构错误(未知关系别名表名)

发布于 2024-08-08 19:55:04 字数 1549 浏览 5 评论 0原文

如何解决此 symfony 错误:

C:\inetpub\wwwroot\project\trunk\preprod\signup>php symfony doctrine:build-schema --trace
>> doctrine  generating yaml schema from database


  [sfException]
  Unknown relation alias table_name


Exception trace:
  at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\cli\sfDoctrineCli.class.php:69
 sfDoctrineCli->notifyException at C:\inetpub\wwwroot\ project\trunk\preprod\signup\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\ven
dor\doctrine\Doctrine\Cli.php:93
 Doctrine_Cli->run at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\task\sfDoctrineB
aseTask.class.php:112
 sfDoctrineBaseTask->callDoctrineCli at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\li
b\task\sfDoctrineBuildSchemaTask.class.php:57
 sfDoctrineBuildSchemaTask->execute at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\task\sfBaseTask.class.php:63

 sfBaseTask->doRun at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\task\sfTask.class.php:77
 sfTask->runFromCLI at C:\inetpub\wwwroot\ project\trunk\preprod\signup\lib\vendor\symfony\lib\command\sfSymfonyCommandApplication.class.ph
p:76
 sfSymfonyCommandApplication->run at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\command\cli.php:20
 include at C:\inetpub\wwwroot\project\trunk\preprod\signup\symfony:14

how to resolve this symfony error :

C:\inetpub\wwwroot\project\trunk\preprod\signup>php symfony doctrine:build-schema --trace
>> doctrine  generating yaml schema from database


  [sfException]
  Unknown relation alias table_name


Exception trace:
  at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\cli\sfDoctrineCli.class.php:69
 sfDoctrineCli->notifyException at C:\inetpub\wwwroot\ project\trunk\preprod\signup\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\ven
dor\doctrine\Doctrine\Cli.php:93
 Doctrine_Cli->run at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\task\sfDoctrineB
aseTask.class.php:112
 sfDoctrineBaseTask->callDoctrineCli at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\li
b\task\sfDoctrineBuildSchemaTask.class.php:57
 sfDoctrineBuildSchemaTask->execute at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\task\sfBaseTask.class.php:63

 sfBaseTask->doRun at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\task\sfTask.class.php:77
 sfTask->runFromCLI at C:\inetpub\wwwroot\ project\trunk\preprod\signup\lib\vendor\symfony\lib\command\sfSymfonyCommandApplication.class.ph
p:76
 sfSymfonyCommandApplication->run at C:\inetpub\wwwroot\project\trunk\preprod\signup\lib\vendor\symfony\lib\command\cli.php:20
 include at C:\inetpub\wwwroot\project\trunk\preprod\signup\symfony:14

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

彩扇题诗 2024-08-15 19:55:04

这是一个模型和缓存问题(重置所有配置并删除模型和数据文件)

rm config/doctrine/schema.yml
rm -r cache/*
rm -r data/*
rm -r lib/model/doctrine/base

symfony cc

我发现了第二个响应,使用 builder.php 补丁让 symfony 1.2 中的学说对象 getter 也抛出此错误。

It is a model and cache issue (reset all configuration and erase model and data files)

rm config/doctrine/schema.yml
rm -r cache/*
rm -r data/*
rm -r lib/model/doctrine/base

symfony cc

I found a second response, using builder.php patch to have doctrine object getters in symfony 1.2 cast this error also.

左秋 2024-08-15 19:55:04

那些使用 Symfony 1.4 的人会很高兴知道有一项任务来清理过时的学说模型。 “./symfony 主义:干净”将摆脱那些令人讨厌的“该模型不再存在的问题”。

those working with Symfony 1.4 will be happy to know that there's a task to clean outdated doctrine models. "./symfony doctrine:clean" will get rid of those nasty "that model don't exist anymore issues".

不顾 2024-08-15 19:55:04

您的一个表似乎引用了另一个名为“table_name”的表(除非 Doctrine 的错误输出替换出现严重错误)。检查所有表上的关系,找到导致此问题的罪魁祸首,如果关系无效,则删除该关系(您实际上有一个名为“table_name”的表吗?)来解决此问题。

如果您有很多表,您可以尝试将整个数据库复制到临时测试数据库中,然后删除一半的表并再次运行生成命令。如果您没有收到错误,您就知道表块不是问题所在,因此删除现有表并恢复另一半。如果同样的错误仍然发生,那么罪魁祸首现在就在当前块内。继续减半,直到只剩下一张表出错,然后您就找到了错误源。

如果您仍然无法找到问题的确切原因,您可以提供 SQL 中的问题表结构以及您正在使用的 Doctrine 版本。

One of your tables appears to be referencing another table called 'table_name' (unless there's something horribly wrong with Doctrine's error output substitution). Check the relations on all of your tables to find the culprit causing this and remove the relation if it's not valid (do you actually have a table called 'table_name'?) to fix this issue.

If you have a lot of tables you can try replicating your entire database into a temporary test DB and then drop half of the tables and run the generate command again. If you don't get the error you know that chunk of tables is not the problem so drop the existing tables and restore the other half. If the same error still occurs the culprit is now within the current chunk. Continue dropping halves until you're left with just one table erroring out and you'll have found your error source.

If you're still having problems locating the exact cause of the problem can you provide your problem table's structure in SQL and also what version of Doctrine you're working with.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文