0

我有 53 个表,其中很多都通过关系相互引用。当我运行时:

php app/console doctrine:schema:create

我得到错误最大嵌套级别达到 100。通过研究,我发现这实际上是 xdebug 阻止无限循环的安全措施。当我删除此限制并再次运行命令时,php cli 停止工作并且我被迫关闭它。

无论如何要在构建数据库结构等步骤中生成模式,然后返回并添加映射和索引,这样它就不会失败?

还是有可能我做错了什么?

MySQL 确实有效,我可以使用相同的方法创建具有较少表/关系的模式。

更新:教义:模式:创建 --dump-sql 也挂起。最大嵌套级别和最大执行时间都设置为无限制。PHP CLI 仍然停止工作:

Problem signature:
Problem Event Name: APPCRASH
Application Name:   php.exe
Application Version:    5.3.26.0
Application Timestamp:  51af706d
Fault Module Name:  ntdll.dll
Fault Module Version:   6.1.7601.17725
Fault Module Timestamp: 4ec49b8f
Exception Code: c00000fd
Exception Offset:   0002e8fb
OS Version: 6.1.7601.2.1.0.256.48
Locale ID:  1033
Additional Information 1:   8983
Additional Information 2:   898375922a25a99ebc5721487ed92891
Additional Information 3:   f337
Additional Information 4:   f3378ae3d6023e7f336317eca89ba0b7
4

2 回答 2

1

You have to increase the value of xdebug.max_nesting_level ( which defaults to 100 ) in your php.ini to circumvent the maximum nesting level of 100 reached error.

You'll most likely run into this issue multiple times for example during cache warmup - not only when trying to create the database schema. Therefore increase the value for all your symfony development - same goes for magento and zf ...

Check the max_execution_time setting aswell and maybe inspect using a profiler (xdebug/xhprof) if the command seems to hang. It might take some time to create the schema, bring some patience :)

There are no options for the doctrine:schema:create command to "split" the operation.

Try if doctrine:schema:create --dump-sql hangs aswell.

A really dirty workaround:

You could define new kernel environments (i.e. step1, step2), create different mappings (getting more and more detailed) or manually configure only a few of them in the first "steps"/environments, register/override them in config_stepx.yml and use something like

doctrine:schema:create --env=step1
doctrine:schema:update --env=step2
...

... but that would really be a mess.

from my experience the command should work even for large datasets. i have created schemas for applications with >100 tables without any problems.

于 2013-10-08T20:47:52.110 回答
0

答案是我的实体在用作主键的同一键上具有自引用的一对一关系。从而在创建过程中创建了一个无限循环。

不太确定为什么它首先存在,其中一些是由教条数据库逆向工程命令生成的。

于 2013-10-08T23:54:49.410 回答