使用 Propel ORM 从 Symfony 中的现有数据库错误生成模型
我正在尝试从现有的 mysql 数据库生成 symfony 项目的数据模型。我正在使用 Propel ORM 使用此命令将该数据库映射到 config/schema.yml 文件中,
php symfony propel:build-schema
并且它可以正常工作。 mySQL 数据库中的所有表在 config/schema.yml 文件中都有自己的描述。当我尝试使用以下命令生成模型类时出现的问题
php symfony propel:build-model
:当 shcema 有大约 40 个表时,执行此命令仅生成 5 组类(BaseName、Name、NamePeer ...)。
我该如何解决这个问题?也许有一个配置文件,其中包含从模式或类似内容生成的最大类。
谢谢:D
编辑:
从数据库自动生成的schema.yml是这样的(由于代码的隐私,我不能在这里发布真正生成的模式)
propel:
_attributes:
package: lib.model
defaultIdMethod: native
table1:
_attributes: { phpName: Table1 }
TABLE_ID: { phpName: TableCod, type: INTEGER, size: '8', required: true, foreignTable: table1, foreignReference: TABLE_ID, onDelete: RESTRICT, onUpdate: RESTRICT }
FOREIGN_KEY: { phpName: ForeignKey, type: INTEGER, size: '8', required: true, foreignTable: other_table, foreignReference: OTHER_TABLE_ID, onDelete: RESTRICT, onUpdate: RESTRICT }
NORMAL_ATRIBUTE: { phpName: NormalAtribute, type: LONGVARCHAR, required: false }
_indexes: { TABLE_ID: [TABLE_ID], FOREIGN_KEY: [OTHER_TABLE_ID] }
table2:
...
edit2:
我发现了错误,我没有没看到>_<
PHP 致命错误:允许的内存大小 33554432 字节已耗尽(尝试 分配35字节)中 /usr/share/php/symfony/util/sfClassManipulator.class.php 第186行
i'm trying to generate a data model of a symfony project from a mysql database already existing. I'm using the Propel ORM to map that database into the config/schema.yml file using this command
php symfony propel:build-schema
and it works correctly. All tables in mySQL database has its own description in config/schema.yml file. The problem i when i try to generate the model classes with the command
php symfony propel:build-model
The execution of this command generates only 5 set of classes (BaseName, Name, NamePeer ...), when the shcema has about 40 tables.
How can i fix that?? maybe there is a configuration file with the maximum classes generated from the schema or something like that.
Thank you :D
edit:
the schema.yml auto generated from the database is like this (i can't post here the real generated schema because of the privacy of the code, i'm )
propel:
_attributes:
package: lib.model
defaultIdMethod: native
table1:
_attributes: { phpName: Table1 }
TABLE_ID: { phpName: TableCod, type: INTEGER, size: '8', required: true, foreignTable: table1, foreignReference: TABLE_ID, onDelete: RESTRICT, onUpdate: RESTRICT }
FOREIGN_KEY: { phpName: ForeignKey, type: INTEGER, size: '8', required: true, foreignTable: other_table, foreignReference: OTHER_TABLE_ID, onDelete: RESTRICT, onUpdate: RESTRICT }
NORMAL_ATRIBUTE: { phpName: NormalAtribute, type: LONGVARCHAR, required: false }
_indexes: { TABLE_ID: [TABLE_ID], FOREIGN_KEY: [OTHER_TABLE_ID] }
table2:
...
edit2:
I found the error, i didn't see it >_<
PHP Fatal error: Allowed memory size
of 33554432 bytes exhausted (tryed to
allocate 35 bytes) in
/usr/share/php/symfony/util/sfClassManipulator.class.php
on line 186
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过编辑 php.ini 文件将脚本内存限制值从 -1 替换为 128 来解决。由于某种原因,symfony 无法正确检测此参数(-1 表示无限制)
Solved by editting the php.ini file replacing the value of the script memory limit from -1 to 128. For some reason, symfony does not detect this parameter correctly (-1 means unlimited)